当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseFileHelper::findFiles方法代码示例

本文整理汇总了PHP中yii\helpers\BaseFileHelper::findFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseFileHelper::findFiles方法的具体用法?PHP BaseFileHelper::findFiles怎么用?PHP BaseFileHelper::findFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\BaseFileHelper的用法示例。


在下文中一共展示了BaseFileHelper::findFiles方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAllClasses

 public static function getAllClasses()
 {
     $result = [];
     foreach (self::getAllAliases() as $alias) {
         $path = \Yii::getAlias($alias);
         $files = is_dir($path) ? BaseFileHelper::findFiles($path) : [$path];
         foreach ($files as $filePath) {
             if (!preg_match('/.*\\/[A-Z]\\w+\\.php/', $filePath)) {
                 continue;
             }
             $className = str_replace([$path, '.php', '/', '@'], [$alias, '', '\\', ''], $filePath);
             $result[] = $className;
         }
     }
     return $result;
 }
开发者ID:bariew,项目名称:yii2-tools,代码行数:16,代码来源:ClassHelper.php

示例2: getImageAdvert

 public static function getImageAdvert($data, $general = true, $original = false)
 {
     $image = [];
     $base = Url::base();
     if ($general) {
         $image[] = $base . '/uploads/adverts/' . $data['idadvert'] . '/general/small_' . $data['general_image'];
     } else {
         $path = \Yii::getAlias("@frontend/web/uploads/adverts/" . $data['idadvert']);
         $files = BaseFileHelper::findFiles($path);
         foreach ($files as $file) {
             if (strstr($file, 'small_') && !strstr($file, 'general')) {
                 $image[] = $base . 'uploads/adverts/' . $data['idadvert'] . '/' . basename($file);
             }
         }
     }
     return $image;
 }
开发者ID:scorp7mix,项目名称:yii,代码行数:17,代码来源:Common.php

示例3: getAllClasses

 public static function getAllClasses()
 {
     if (self::$_allClasses !== null) {
         return self::$_allClasses;
     }
     $result = [];
     foreach (self::getAllAliases() as $alias) {
         $path = Yii::getAlias($alias);
         if (!file_exists($path) || is_file($path)) {
             continue;
         }
         $files = BaseFileHelper::findFiles($path, ['except' => ['/yii2-gii/', 'Yii.php']]);
         foreach ($files as $filePath) {
             if (!preg_match('/.*\\/[A-Z]\\w+\\.php/', $filePath)) {
                 continue;
             }
             $className = str_replace([$path, '.php', '/', '@'], [$alias, '', '\\', ''], $filePath);
             $result[] = $className;
         }
     }
     return self::$_allClasses = $result;
 }
开发者ID:EsoftsLimited,项目名称:yii2-plugins-manager,代码行数:22,代码来源:Crawler.php

示例4: afterSave

 /**
  * После сохранения
  */
 public function afterSave()
 {
     $this->path = null;
     //Сохраняем файл
     foreach ($this->fields as $field) {
         $isWeb = $this->_webFile[$field];
         $file = null;
         if ($isWeb || ($file = UploadedFile::getInstance($this->owner, $field))) {
             //Директория для сохранения
             $path = $this->getPath($field);
             $files = BaseFileHelper::findFiles($path);
             foreach ($files as $cFile) {
                 @unlink($cFile);
             }
             $fileName = self::normalize($isWeb ? $this->_names[$field] : $file->name);
             $filePath = BaseFileHelper::normalizePath($path . '/' . $fileName);
             // d($filePath);
             if ($this->_webFile[$field]) {
                 $result = @copy($this->_webFile[$field], $filePath);
                 if (!$result) {
                     $fileName = '';
                 }
             } else {
                 $file->saveAs($path . '/' . $fileName);
                 chmod($filePath, 0666);
             }
             $this->owner->updateAttributes(array($field => $fileName));
         }
     }
     $this->setAttach();
 }
开发者ID:h11Nox,项目名称:slug,代码行数:34,代码来源:FileBehavior.php

示例5: cleanup

 /**
  * Cleanup all files in the zip output path.
  */
 protected function cleanup()
 {
     $files = BaseFileHelper::findFiles($this->getBaseTempFolderPath(), ['filter' => function ($path) {
         return time() - filemtime($path) > 30 ? true : false;
     }, 'recursive' => true]);
     foreach ($files as $file) {
         unlink($file);
     }
 }
开发者ID:humhub,项目名称:humhub-modules-cfiles,代码行数:12,代码来源:ZipController.php

示例6: findFiles

 /**
  * @inheritdoc
  * @staticvar boolean $searchProcess variable that indicates call method is recursively called or this is the first call.
  * Fixes logic of parent method. Some file systems may has file for which is_file === false and is_dir === false.
  * For example: windows file system has it where file has "alien" character set.
  * 
  * The method returns file paths which have local file system charset.
  * The `$dir` param must be in local file system charset too.
  */
 public static function findFiles($dir, $options = [])
 {
     static $searchProcess = false;
     if (!$searchProcess) {
         $searchProcess = true;
         try {
             $result = parent::findFiles($dir, $options);
         } catch (\Exception $ex) {
             $searchProcess = false;
             throw $ex;
         }
         $searchProcess = false;
         return $result;
     }
     if (!is_dir($dir)) {
         return [];
     }
     return parent::findFiles($dir, $options);
 }
开发者ID:alex-dwt,项目名称:file,代码行数:28,代码来源:BaseFileSystemHelper.php


注:本文中的yii\helpers\BaseFileHelper::findFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。