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


PHP Filesystem::name方法代码示例

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


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

示例1: get

 public function get($path, array $data = array())
 {
     $filename = $this->files->name($path) . '.' . $this->files->extension($path);
     $compile_path = \Config::get('view.compiled') . DIRECTORY_SEPARATOR . $filename;
     $template_last_modified = $this->files->lastModified($path);
     $cache_last_modified = $this->files->isFile($compile_path) ? $this->files->lastModified($compile_path) : $template_last_modified;
     $view = $this->files->get($path);
     $app = app();
     // $m = new Mustache_Engine($app['config']->get('handlelars'));
     // Configuration
     $cache_disabled = false;
     $helpers = \Config::get('handlelars.helpers');
     // Precompile templates to view cache when necessary
     $compile = $template_last_modified >= $cache_last_modified || $cache_disabled;
     if ($compile) {
         $tpl = LightnCandy::compile($view, compact('helpers'));
         $this->files->put($compile_path, $tpl);
     }
     if (isset($data['__context']) && is_object($data['__context'])) {
         $data = $data['__context'];
     } else {
         $data = array_map(function ($item) {
             return is_object($item) && method_exists($item, 'toArray') ? $item->toArray() : $item;
         }, $data);
     }
     $renderer = $this->files->getRequire($compile_path);
     return $renderer($data);
 }
开发者ID:truemedia,项目名称:handlelars,代码行数:28,代码来源:MustacheEngine.php

示例2: fakeUser

 public function fakeUser()
 {
     $this->login();
     $batch = Input::get('batch', 0);
     if (!$batch) {
         echo "need batch number";
         die;
     }
     $mobile = DB::table('users')->select('u_mobile')->where('u_mobile', '<', '11000000000')->orderBy('u_mobile', 'DESC')->first();
     if (empty($mobile->u_mobile)) {
         $mobile = 10000000000;
     } else {
         $mobile = $mobile->u_mobile;
     }
     echo "mobile start at " . $mobile . "</br>";
     echo "batch number is " . $batch . "</br>";
     set_time_limit(0);
     $file = new Filesystem();
     $re = $file->files('/var/www/qingnianchuangke/head_img');
     foreach ($re as $key => $path) {
         $user = new User();
         $user->u_mobile = ++$mobile;
         $user->u_name = $user->u_nickname = $file->name($path);
         $ext = $file->extension($path);
         echo "add:" . $user->u_name . "</br>";
         $user->u_head_img = 'http://qnck001.oss-cn-hangzhou.aliyuncs.com/user_head/' . $batch . '/' . ($key + 1) . '.' . $ext;
         $user->fakeUser();
     }
     echo 'done';
 }
开发者ID:qnck,项目名称:qingnianchuangke,代码行数:30,代码来源:EmergencyController.php

示例3: edit

 /**
  * Edit a file.
  * @param  string $path    Path to the file.
  * @param  string $search  What to replace.
  * @param  string $replace Text to replace with.
  * @return $this|Exception
  */
 public function edit($path)
 {
     $this->path = realpath(base_path($this->files->dirname($path)));
     $this->class = $this->files->name($path);
     $this->setFile($path);
     return $this;
 }
开发者ID:jeroen-g,项目名称:laravel-builder,代码行数:14,代码来源:Builder.php

示例4: getLocales

 public function getLocales()
 {
     if (empty($this->locales)) {
         $locales = array_merge([config('app.locale')], Translation::groupBy('locale')->lists('locale'));
         foreach ($this->files->directories($this->app->langPath()) as $localeDir) {
             $locales[] = $this->files->name($localeDir);
         }
         $this->locales = array_unique($locales);
         sort($this->locales);
     }
     return array_diff($this->locales, $this->ignoreLocales);
 }
开发者ID:txandy,项目名称:laravel-translation-manager,代码行数:12,代码来源:Manager.php

示例5: __construct

 private function __construct()
 {
     $this->_http = new Http();
     // Инициализация конфигов
     $fileSystem = new Filesystem();
     $files = $fileSystem->allFiles('config');
     foreach ($files as $file) {
         if (is_array($fileSystem->getRequire($file))) {
             $this->setConfig($fileSystem->getRequire($file), $fileSystem->name($file));
         }
     }
 }
开发者ID:ArmSALArmy,项目名称:Banants,代码行数:12,代码来源:App.php

示例6: parse

 /**
  * 解析檔案.
  *
  * @return array
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 protected function parse()
 {
     foreach ($this->files as $file) {
         $content = $this->removeAnnoys($this->filesystem->get($file));
         $rows = HtmlDomParser::str_get_html($content)->find('tr');
         // 系所代碼
         $department = $this->filesystem->name($file);
         // 需先移除表格標題列
         foreach (array_slice($rows, 1) as $row) {
             $courses[$department][] = $this->getColumns($row, $department);
         }
         if (isset($courses[$department])) {
             $this->numberOfCourses += count($courses[$department]);
         }
     }
     return $courses ?? [];
 }
开发者ID:BePsvPT,项目名称:CCU-Plus,代码行数:23,代码来源:ImportCourse.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $file = $input->getArgument('sql-file');
     $filesystem = new Filesystem();
     if (!$filesystem->isFile($file)) {
         throw new FileNotFoundException("We could not find the file you wanted to send to the remote server");
     }
     $vars = $input->getArguments();
     $keyLocation = $vars['ssh-secret'];
     if (!$filesystem->isFile($keyLocation)) {
         $output->writeln(sprintf('<error>Oh NO! We couldn\'t find the private key located here: %s</error>', $keyLocation));
         $pattern = '/^~\\//i';
         if (preg_match($pattern, $keyLocation) === 1) {
             $output->writeln('<error>Maybe use the key absolute path?</error>');
         }
         $output->writeln('<error>We are going to bail and let you fix this. </error>');
         return;
     }
     $auth = ['key' => $vars['ssh-secret']];
     $output->writeln("Connecting to remote host");
     $remote = new Connection('remote', $vars['ssh-host'], $vars['ssh-user'], $auth);
     if ($remote->getGateway()) {
         $output->writeln("Connection established. Transferring file " . $file);
     }
     $fileName = $filesystem->name($file);
     $remoteFile = $fileName;
     $remote->put($file, $remoteFile);
     $output->writeln("File transfered. Importing into database");
     $mysqlCommandFormat = "mysql -u %s -p'%s' %s < %s";
     $mysqlImportCommand = sprintf($mysqlCommandFormat, $vars['db-user'], $vars['db-password'], $vars['db-name'], $remoteFile);
     $mysqlDropDbCommand = sprintf("mysql -u %s -p'%s' -e 'DROP DATABASE %s;'", $vars['db-user'], $vars['db-password'], $vars['db-name']);
     $mysqlCreateDbCommand = sprintf("mysql -u %s -p'%s' -e 'CREATE DATABASE %s;'", $vars['db-user'], $vars['db-password'], $vars['db-name']);
     $remote->run($mysqlDropDbCommand, function ($line) use($output) {
     });
     $remote->run($mysqlCreateDbCommand, function ($line) use($output) {
     });
     $remote->run($mysqlImportCommand, function ($line) use($output) {
         $output->writeln($line);
     });
     /*
      * Cleanup the remote machine
      */
     $remote->run('rm ' . $remoteFile, function ($line) {
     });
     $output->writeln("Remote Importer is ALL DONE !!!");
 }
开发者ID:jjpmann,项目名称:syncer,代码行数:46,代码来源:RemoteImporterCommand.php

示例8: name

 /**
  * Extract the file name from a file path.
  *
  * @param string $path
  * @return string 
  * @static 
  */
 public static function name($path)
 {
     return \Illuminate\Filesystem\Filesystem::name($path);
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php

示例9: setConfigValue

 /**
  * set new Config value by given key and value.
  * And save the file.
  *
  * @param $key
  * @param $value
  *
  * @return int
  */
 protected function setConfigValue($key, $value)
 {
     $fs = new Filesystem();
     $fn = $fs->name($key);
     // First string until dot should be the file name.
     $filename = strstr($fn, '.', true);
     if (strpos($filename, '.') !== false) {
         $filename = $fn;
     }
     $this->items->set($key, $value);
     return $fs->put($this->getConfigDir() . DIRECTORY_SEPARATOR . $filename . '.php', '<?php return ' . var_export($this->items[$fn], true) . ';');
 }
开发者ID:RaphaelBronsveld,项目名称:configconsoleapplication,代码行数:21,代码来源:ConfigCommand.php


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