本文整理汇总了PHP中FileUtil::getFilesFromDir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::getFilesFromDir方法的具体用法?PHP FileUtil::getFilesFromDir怎么用?PHP FileUtil::getFilesFromDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtil
的用法示例。
在下文中一共展示了FileUtil::getFilesFromDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleImports
/**
* Import all files that need to be included(for lazy loading)
* @param $event
*/
public function handleImports($event)
{
try {
$filesToInclude = GeneralCache::getEntry('filesToIncludeForTests');
} catch (NotFoundException $e) {
$filesToInclude = FileUtil::getFilesFromDir(Yii::app()->basePath . '/modules', Yii::app()->basePath . '/modules', 'application.modules', true);
$filesToIncludeFromFramework = FileUtil::getFilesFromDir(Yii::app()->basePath . '/core', Yii::app()->basePath . '/core', 'application.core', true);
$totalFilesToIncludeFromModules = count($filesToInclude);
foreach ($filesToIncludeFromFramework as $key => $file) {
$filesToInclude[$totalFilesToIncludeFromModules + $key] = $file;
}
GeneralCache::cacheEntry('filesToIncludeForTests', $filesToInclude);
}
foreach ($filesToInclude as $file) {
Yii::import($file);
}
}
示例2: handleImports
/**
* Import all files that need to be included(for lazy loading)
* @param $event
*/
public function handleImports($event)
{
//Clears file cache so that everything is clean.
if (isset($_GET['clearCache']) && $_GET['clearCache'] == 1) {
GeneralCache::forgetEntry('filesClassMap');
}
try {
// not using default value to save cpu cycles on requests that follow the first exception.
Yii::$classMap = GeneralCache::getEntry('filesClassMap');
} catch (NotFoundException $e) {
$filesToInclude = FileUtil::getFilesFromDir(Yii::app()->basePath . '/modules', Yii::app()->basePath . '/modules', 'application.modules');
$filesToIncludeFromCore = FileUtil::getFilesFromDir(Yii::app()->basePath . '/core', Yii::app()->basePath . '/core', 'application.core');
$totalFilesToIncludeFromModules = count($filesToInclude);
foreach ($filesToIncludeFromCore as $key => $file) {
$filesToInclude[$totalFilesToIncludeFromModules + $key] = $file;
}
foreach ($filesToInclude as $file) {
Yii::import($file);
}
GeneralCache::cacheEntry('filesClassMap', Yii::$classMap);
}
Yii::app()->setAllClassesAreImported();
}