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


PHP File::files方法代码示例

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


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

示例1: getStoreBanner

function getStoreBanner($store_name)
{
    $dir = 'assets/img/store/' . $store_name . '/banner';
    if (!file_exists($dir)) {
        mkdir($dir, 0777, true);
    }
    $listFiles = [];
    $files = \File::files($dir);
    foreach ($files as $path) {
        $listFiles[] = pathinfo($path);
    }
    $count = 0;
    foreach ($listFiles as $prodpath) {
        if ($count == 0) {
            $dirname = $prodpath['dirname'];
            $basename = $prodpath['basename'];
        }
        $count++;
    }
    if ($count > 0) {
        return $dirname . '/' . $basename;
    } else {
        return 'assets/img/nobanner.png';
    }
}
开发者ID:arielespiritu,项目名称:homemalldev,代码行数:25,代码来源:helpers.php

示例2: it_does_not_cause_change_to_sql_directory

 /** @test */
 public function it_does_not_cause_change_to_sql_directory()
 {
     $pre_contents = \File::files(config('csvimport.sql_directory'));
     $this->importer->import();
     $post_contents = \File::files(config('csvimport.sql_directory'));
     $this->assertEquals($pre_contents, $post_contents);
 }
开发者ID:rtmatt,项目名称:import,代码行数:8,代码来源:CSVImporterTest.php

示例3: deal

 /**
  * 文件上传处理
  *
  * @param string $name
  *
  * @return bool
  */
 protected static function deal($name = 'file')
 {
     // 判断文件是否上传
     if (!isset($_FILES[$name])) {
         self::$error = '上传文件不能为空!';
         return false;
     }
     // 获取上传文件相关信息
     self::$files = $_FILES[$name];
     // 判断文件上传是否成功
     if ($msg = self::getFailed()) {
         self::$error = $msg;
         return false;
     }
     // 判断上传文件类型是否合法
     if (!self::isAllowType()) {
         self::$error = '上传文件类型不允许!';
         return false;
     }
     // 判断上传文件大小是否合法
     if (!self::isAllowSize()) {
         self::$error = '上传文件大小不允许!';
         return false;
     }
     return true;
 }
开发者ID:qxy735,项目名称:YuYi-General,代码行数:33,代码来源:File.php

示例4: send

 public function send(JustifFormRequest $request)
 {
     \Mail::send('emails.justificatif', array('username' => $request->get('username'), 'email' => $request->get('email'), 'justif' => $request->get('justificatif')), function ($message) use($request) {
         $email = $request->email;
         $username = $request->username;
         $justif = $request->file('justificatif');
         if ($justif->isValid()) {
             $path = config('images.inscription');
             $files = \File::files($path);
             $newfile = $path . '/' . $username;
             foreach ($files as $file) {
                 $fileWithoutExtension = substr($file, 0, -4);
                 if ($fileWithoutExtension === $newfile) {
                     \File::Delete($fileWithoutExtension . '.png');
                     \File::Delete($fileWithoutExtension . '.pdf');
                     \File::Delete($fileWithoutExtension . '.jpg');
                 }
             }
             $extension = $justif->getClientOriginalExtension();
             $name = $username . '.' . $extension;
             $justif->move($path, $name);
         }
         $file = $path . '/' . $name;
         $message->attach($file);
         $message->from($request->email);
         $message->to('plateulere@gmail.com', 'Equipe Roadweb')->subject('envoi de justificatif');
         $message->setReplyTo($email);
     });
     return \Redirect::route('compte')->with('message', 'Votre justificatif a bien été envoyé ! Vous serez informé de la validation de vos droits dans les 24 à 48h.');
 }
开发者ID:celine24,项目名称:Back,代码行数:30,代码来源:SubController.php

示例5: bindRepositories

 /**
  *
  */
 private function bindRepositories()
 {
     // Load config parameters needed.
     $repositoriesBasePath = config('lararepo.path');
     $baseNamespace = rtrim(config('lararepo.namespace'), '\\') . '\\';
     $implementation = config('lararepo.implementation');
     $skipRepositories = config('lararepo.skip');
     $allRepos = \File::files($repositoriesBasePath);
     foreach ($allRepos as $repo) {
         $interface = basename($repo);
         if (in_array($interface, $skipRepositories)) {
             continue;
         } else {
             $interfaceName = str_replace('.php', '', $interface);
             $commonName = str_replace('Interface', '', $interfaceName);
             $interfaceFullClassName = $baseNamespace . $interfaceName;
             $implementationFullClassName = $baseNamespace . $implementation . '\\' . $commonName;
             if (class_exists($implementationFullClassName)) {
                 // Bind the class.
                 $this->app->bind($interfaceFullClassName, function ($app) use($implementationFullClassName) {
                     return $app->make($implementationFullClassName);
                 });
             }
         }
     }
 }
开发者ID:jespejoh,项目名称:lararepo,代码行数:29,代码来源:LararepoServiceProvider.php

示例6: getModels

 /**
  * Get the model names from their filename.
  *
  * @return array
  */
 protected function getModels()
 {
     $files = File::files(base_path() . '/app/models');
     foreach ($files as $file) {
         $models[] = pathinfo($file, PATHINFO_FILENAME);
     }
     return $models;
 }
开发者ID:riehlemt,项目名称:neontsunami,代码行数:13,代码来源:TestCase.php

示例7: copyFiles

 protected function copyFiles()
 {
     $files = \File::files(base_path());
     foreach ($files as $file) {
         $path = str_replace(base_path(), '', $file);
         \File::copy($file, base_path() . '/backup/' . $this->timestamp . '/' . $path);
     }
 }
开发者ID:voltcms,项目名称:backup,代码行数:8,代码来源:Backup.php

示例8: getAvailableTemplates

 public function getAvailableTemplates()
 {
     $template = \CMS::getTemplatePath();
     $files = \File::files('../app/views/templates/' . $template . '/pages');
     foreach ($files as $index => $file) {
         $files[$index] = str_replace('../app/views/templates/' . $template . '/', '', $file);
     }
     return $files;
 }
开发者ID:voltcms,项目名称:voltcms,代码行数:9,代码来源:template.php

示例9: getImages

 /**
  * @return array
  */
 public function getImages($folder)
 {
     $base = config('gallery-settings.home_dir');
     $path = trim($folder, '/');
     $pathname = $base . $path;
     $pictures = array_chunk(\File::files($pathname), 2);
     foreach ($pictures as $chunk) {
         $this->dispatch(new GenerateThumbnails($chunk));
     }
 }
开发者ID:Ortix92,项目名称:tsutsu-gallery,代码行数:13,代码来源:ThumbnailsController.php

示例10: seedOperators

 private function seedOperators()
 {
     $sql_files = File::files($this->operatorsPath);
     $index = 0;
     foreach ($sql_files as $sql) {
         $current[$index] = File::get($sql);
         Queue::push('OperaterInsertQueue', $current[$index]);
         unset($current[$index]);
         $index++;
     }
 }
开发者ID:ddedic,项目名称:numtector,代码行数:11,代码来源:2013_11_02_164010_create_operators_table.php

示例11: testConstruction

 public function testConstruction()
 {
     $kirby = $this->kirbyInstance();
     $site = $this->siteInstance($kirby);
     $page = new Page($site, '1-a');
     $files = new Files($page);
     $file = new File($files, 'test.js');
     $this->assertInstanceOf('Kirby', $file->kirby());
     $this->assertEquals($kirby, $file->kirby());
     $this->assertInstanceOf('Site', $file->site());
     $this->assertEquals($site, $file->site());
     $this->assertInstanceOf('Page', $file->page());
     $this->assertEquals($page, $file->page());
     $this->assertInstanceOf('Files', $file->files());
     $this->assertEquals($files, $file->files());
     $this->assertInstanceOf('Media', $file);
     $this->assertEquals($page->root() . DS . 'test.js', $file->root());
     $this->assertEquals($page->contentUrl() . '/test.js', $file->url());
     $this->assertEquals($file->root(), (string) $file);
 }
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:20,代码来源:FileTest.php

示例12: init

 private function init()
 {
     $this->classes = [];
     $dir = config('cms.path.data');
     foreach (\File::files($dir) as $file) {
         $basename = basename($file, '.php');
         $className = '\\App\\CMS\\Data\\' . $basename;
         $class = new $className();
         $this->classes[$class->getAccessor()] = $class;
     }
 }
开发者ID:siipis,项目名称:cms,代码行数:11,代码来源:DataParser.php

示例13: getKeys

 public function getKeys($path, $langs)
 {
     $keys = [];
     foreach ($langs as $lang) {
         foreach (File::files($path . '/' . trim($lang, '/')) as $file) {
             $translation = (require $file);
             $keys = array_merge($keys, $this->extractKeys($translation, str_replace('.php', '', basename($file))));
         }
     }
     return array_unique($keys);
 }
开发者ID:hpkns,项目名称:laravel-config,代码行数:11,代码来源:ConfigDump.php

示例14: checkLastBackupTime

 /**
  * Check last backup time
  *
  * Checks the modification time of files in authenticated user archive folder and if one of them is less than
  * 5 minutes ago.
  *
  * @param User $user
  *
  * @return bool  False if last backup was made less than 5 minutes ago, true otherwise
  */
 public static function checkLastBackupTime(User $user)
 {
     $zipFiles = File::files(storage_path() . '/backups/' . $user->getId() . '/zip/');
     foreach ($zipFiles as $zipFile) {
         $timeOfBackup = File::lastModified($zipFile);
         if ($timeOfBackup > strtotime('-5 minutes')) {
             return false;
         }
     }
     return true;
 }
开发者ID:ronnie,项目名称:Gist-List,代码行数:21,代码来源:GistBackupHandler.php

示例15: browseImage

 public function browseImage(Request $request)
 {
     DB::table('test')->insert(['msg' => 'work fine']);
     // $send = SendMail::all();
     $test = $_GET['CKEditorFuncNum'];
     $images = [];
     $files = \File::files(public_path() . '/uploads/about');
     foreach ($files as $file) {
         $images[] = pathinfo($file);
     }
     return view('page.home', ['files' => $images, 'test' => $test]);
 }
开发者ID:celius55,项目名称:clientmail,代码行数:12,代码来源:PageController.php


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