• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP storage_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中storage_path函数的典型用法代码示例。如果您正苦于以下问题:PHP storage_path函数的具体用法?PHP storage_path怎么用?PHP storage_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: register

 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('League\\Glide\\Server', function ($app) {
         $filesystem = $app->make('Illuminate\\Contracts\\Filesystem\\Filesystem');
         return \League\Glide\ServerFactory::create(['source' => storage_path(), 'cache' => storage_path(), 'source_path_prefix' => 'app/', 'cache_path_prefix' => 'app/.cache', 'base_url' => 'img']);
     });
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:12,代码来源:AppServiceProvider.php


示例2: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // Set directories
     $inputPath = base_path('resources/views');
     $outputPath = storage_path('gettext');
     // Create $outputPath or empty it if already exists
     if (File::isDirectory($outputPath)) {
         File::cleanDirectory($outputPath);
     } else {
         File::makeDirectory($outputPath);
     }
     // Configure BladeCompiler to use our own custom storage subfolder
     $compiler = new BladeCompiler(new Filesystem(), $outputPath);
     $compiled = 0;
     // Get all view files
     $allFiles = File::allFiles($inputPath);
     foreach ($allFiles as $f) {
         // Skip not blade templates
         $file = $f->getPathName();
         if ('.blade.php' !== substr($file, -10)) {
             continue;
         }
         // Compile the view
         $compiler->compile($file);
         $compiled++;
         // Rename to human friendly
         $human = str_replace(DIRECTORY_SEPARATOR, '-', ltrim($f->getRelativePathname(), DIRECTORY_SEPARATOR));
         File::move($outputPath . DIRECTORY_SEPARATOR . sha1($file) . '.php', $outputPath . DIRECTORY_SEPARATOR . $human);
     }
     if ($compiled) {
         $this->info("{$compiled} files compiled.");
     } else {
         $this->error('No .blade.php files found in ' . $inputPath);
     }
 }
开发者ID:nerea91,项目名称:laravel,代码行数:40,代码来源:GettextCommand.php


示例3: setup_cache_directory

 /**
  * Used in order to setup the cache directory for future use.
  * 
  * @param string The configuration to use
  * @return string The folder that is being cached to
  */
 private function setup_cache_directory($configuration)
 {
     // Check if caching is enabled
     $cache_enabled = $this->read_config($configuration, 'cache.enabled', false);
     // Is caching enabled?
     if (!$cache_enabled) {
         // It is disabled, so skip it
         return false;
     }
     // Grab the cache location
     $cache_location = storage_path($this->read_config($configuration, 'cache.location', 'rss-feeds'));
     // Is the last character a slash?
     if (substr($cache_location, -1) != DIRECTORY_SEPARATOR) {
         // Add in the slash at the end
         $cache_location .= DIRECTORY_SEPARATOR;
     }
     // Check if the folder is available
     if (!file_exists($cache_location)) {
         // It didn't, so make it
         mkdir($cache_location, 0777);
         // Also add in a .gitignore file
         file_put_contents($cache_location . '.gitignore', '!.gitignore' . PHP_EOL . '*');
     }
     return $cache_location;
 }
开发者ID:vedmant,项目名称:laravel-feed-reader,代码行数:31,代码来源:FeedReader.php


示例4: __construct

 public function __construct()
 {
     $this->processBuilder = new ProcessBuilder();
     $this->git_location = config('gitcontrol.gitpath', '/usr/bin/git');
     $this->git_tmp = config('gitcontrol.tmppath', storage_path('tmp'));
     $this->git_mirror = config('gitcontrol.mirrorpath', storage_path('git'));
 }
开发者ID:nothing628,项目名称:git-control,代码行数:7,代码来源:GitProcess.php


示例5: download

 public function download($id)
 {
     $file = File::findOrFail($id);
     $pathToFile = 'get_link_to_download/' . md5($file->name . time());
     FileHelpers::copy(storage_path('app') . '/' . $file->local_name, $pathToFile);
     return response()->download($pathToFile, $file->name, ['Content-Type'])->deleteFileAfterSend(true);
 }
开发者ID:quantbm,项目名称:RimDrive,代码行数:7,代码来源:FilesController.php


示例6: __construct

 /**
  * Create a new job instance.
  *
  * @return void
  */
 public function __construct(Chapter $chapter)
 {
     $this->chapter = $chapter;
     $this->fileName = storage_path('app/pdfs/') . $this->chapter->url;
     $this->pdfPreview = new \FPDI('portrait', 'pt', 'A4');
     $this->totalPageNumber = $this->pdfPreview->setSourceFile($this->fileName);
 }
开发者ID:uusa35,项目名称:ebook,代码行数:12,代码来源:CreateChapterPreview.php


示例7: __construct

 /**
  * Create a new command instance.
  *
  * @return void
  */
 public function __construct($file = 'forever.js')
 {
     parent::__construct();
     $this->file = $file;
     $this->filePath = base_path($file);
     $this->options = ['-l' => storage_path('logs/forever.log'), '-o' => storage_path('logs/forever.out.log'), '-e' => storage_path('logs/forever.err.log'), '--id' => strtolower(config('app.title')), '--append' => '', '--verbose' => ''];
 }
开发者ID:multimedia-street,项目名称:forever,代码行数:12,代码来源:ForeverCommand.php


示例8: register

 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     parent::register();
     $this->app->singleton(['server' => Contracts\Factory::class], function ($app) {
         return new Server\Factory($app, storage_path('server'));
     });
 }
开发者ID:apolune,项目名称:server,代码行数:12,代码来源:ServerServiceProvider.php


示例9: image

 public function image()
 {
     if (!empty($this->photo_url) && File::exists(storage_path($this->photo_url))) {
         return 'images/image.php?id=' . $this->photo_url;
     }
     return 'images/missing.png';
 }
开发者ID:unicorn-softwares,项目名称:employment_bank,代码行数:7,代码来源:CandidateInfo.php


示例10: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $market = $this->argument('market');
     $fileName = storage_path() . '/app/' . time() . '.xls';
     file_put_contents($fileName, $this->getHtmlContent($this->argument('url')));
     $reader = PHPExcel_IOFactory::createReader('Excel5');
     $excel = $reader->load($fileName);
     $sheet = $excel->getSheet();
     $i = 2;
     while ($sheet->getCell("A{$i}") != "") {
         $code = $sheet->getCell("B{$i}");
         $name = $sheet->getCell("C{$i}");
         $issue = Issue::where('code', $code)->first();
         if (!$issue) {
             $issue = new Issue();
         }
         $issue->code = $code;
         $issue->name = $name;
         $issue->market = $market;
         if ($issue->getOriginal() != $issue->getAttributes()) {
             $issue->save();
         }
         $i++;
     }
     unlink($fileName);
 }
开发者ID:akira-takahashi-jp,项目名称:stock_crawler,代码行数:31,代码来源:ImportIssue.php


示例11: __construct

 /**
  * Create a new command instance.
  *
  * @param \Illuminate\Filesystem\Filesystem
  *
  * @return void
  */
 public function __construct(Filesystem $files)
 {
     parent::__construct();
     $this->deletable = time() - 60 * 60 * 1.5;
     $this->base = storage_path('releases');
     $this->files = $files;
 }
开发者ID:bigbitecreative,项目名称:paddle,代码行数:14,代码来源:ClearOld.php


示例12: __construct

 public function __construct(Filesystem $filesystem)
 {
     $this->file = $filesystem;
     $this->path = storage_path('realtime') . '/';
     //ensure existence
     $this->file->makeDirectory($this->path, 0777, true, true);
 }
开发者ID:weddingjuma,项目名称:world,代码行数:7,代码来源:RealTimeRepository.php


示例13: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     echo "Run task: #" . $this->job_id, "\n";
     $task = Tasks::find($this->job_id);
     $task->status = Tasks::RUN;
     $task->save();
     $client = new \Hoa\Websocket\Client(new \Hoa\Socket\Client('tcp://127.0.0.1:8889'));
     $client->setHost('127.0.0.1');
     $client->connect();
     $client->send(json_encode(["command" => webSocket::BROADCASTIF, "jobid" => $this->job_id, "msg" => json_encode(["jid" => $this->job_id, "status" => Tasks::RUN])]));
     $builder = new ProcessBuilder();
     $builder->setPrefix('ansible-playbook');
     $builder->setArguments(["-i", "inv" . $this->job_id, "yml" . $this->job_id]);
     $builder->setWorkingDirectory(storage_path("roles"));
     $process = $builder->getProcess();
     $process->run();
     //echo $process->getOutput() . "\n";
     $client->send(json_encode(["command" => webSocket::BROADCASTIF, "jobid" => $this->job_id, "msg" => json_encode(["jid" => $this->job_id, "status" => Tasks::FINISH])]));
     $client->close();
     $task->status = Tasks::FINISH;
     $task->content = file_get_contents(storage_path("tmp/log" . $this->job_id . ".txt"));
     $task->save();
     unlink(storage_path("roles/yml" . $this->job_id));
     unlink(storage_path("roles/inv" . $this->job_id));
     unlink(storage_path("tmp/log" . $this->job_id . ".txt"));
     echo "End task: #" . $this->job_id, "\n";
 }
开发者ID:mangareader,项目名称:laravel-ansible,代码行数:32,代码来源:runAnsible.php


示例14: onCrudSaved

 /**
  * Seed the form with defaults that are stored in the session
  *
  * @param Model $model
  * @param CrudController $crudController
  */
 public function onCrudSaved(Model $model, CrudController $crudController)
 {
     $fb = $crudController->getFormBuilder();
     foreach ($fb->getElements() as $name => $element) {
         if (!$element instanceof FileElement) {
             continue;
         }
         if ($model instanceof File) {
             $file = $model;
         } else {
             $file = new File();
         }
         if ($uploaded = Input::file($name)) {
             // Save the file to the disk
             $uploaded->move(storage_path($element->getPath()), $uploaded->getClientOriginalName());
             // Update the file model with metadata
             $file->name = $uploaded->getClientOriginalName();
             $file->extension = $uploaded->getClientOriginalExtension();
             $file->size = $uploaded->getClientSize();
             $file->path = $element->getPath() . '/' . $uploaded->getClientOriginalName();
             $file->save();
             if (!$model instanceof File) {
                 $model->{$name} = $element->getPath() . '/' . $uploaded->getClientOriginalName();
                 $model->save();
             }
         }
     }
 }
开发者ID:boyhagemann,项目名称:uploads,代码行数:34,代码来源:SaveFileToDisk.php


示例15: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     parent::fire();
     $serverHost = $this->option('host');
     $serverPort = $this->option('port');
     $serverEnv = $this->option('env');
     $assetsServerHost = $this->option('larasset-host');
     $assetsServerPort = $this->option('larasset-port');
     putenv('LARASSET_PORT=' . $assetsServerPort);
     if ($this->option('larasset-environment')) {
         // TODO: Remove the DEPRECATED stuff in the next minor version (0.10.0 or 1.0.0)
         $this->comment("WARN: The '--larasset-environment' option is DEPRECATED, use '--larasset-env' option instead please.");
         $assetsServerEnv = $this->option('larasset-environment');
     } else {
         $assetsServerEnv = $this->option('larasset-env');
     }
     // Run assets server in a background process
     $command = "php artisan larasset:serve --port=" . $assetsServerPort . " --host=" . $assetsServerHost . " --assets-env=" . $assetsServerEnv;
     $this->info("Start the assets server...");
     $serverLogsPath = $this->normalizePath(storage_path('logs/larasset_server.log'));
     $this->line('Assets server logs are stored in "' . $serverLogsPath . '"');
     $this->execInBackground($command, $serverLogsPath);
     // Run PHP application server
     $this->call('serve', ['--host' => $serverHost, '--port' => $serverPort, '--env' => $serverEnv]);
 }
开发者ID:efficiently,项目名称:larasset,代码行数:30,代码来源:ServerCommand.php


示例16: installCommand

 protected function installCommand()
 {
     $this->app->bind('Flarum\\Install\\Prerequisite\\PrerequisiteInterface', function () {
         return new Composite(new PhpVersion('5.5.0'), new PhpExtensions(['dom', 'fileinfo', 'gd', 'json', 'mbstring', 'openssl', 'pdo_mysql']), new WritablePaths([public_path(), public_path('assets'), public_path('extensions'), storage_path()]));
     });
     $this->commands([InstallCommand::class]);
 }
开发者ID:hyn,项目名称:laravel-flarum,代码行数:7,代码来源:FlarumServiceProvider.php


示例17: register

 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $configPath = __DIR__ . '/../config/sql-logging.php';
     $this->mergeConfigFrom($configPath, 'sql-logging');
     if (config('sql-logging.log', false)) {
         Event::listen('illuminate.query', function ($query, $bindings, $time) {
             $data = compact('bindings', 'time');
             // Format binding data for sql insertion
             foreach ($bindings as $i => $binding) {
                 if ($binding instanceof \DateTime) {
                     $bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
                 } else {
                     if (is_string($binding)) {
                         $bindings[$i] = "'{$binding}'";
                     }
                 }
             }
             // Insert bindings into query
             $query = str_replace(array('%', '?'), array('%%', '%s'), $query);
             $query = vsprintf($query, $bindings);
             $log = new Logger('sql');
             $log->pushHandler(new StreamHandler(storage_path() . '/logs/sql-' . date('Y-m-d') . '.log', Logger::INFO));
             // add records to the log
             $log->addInfo($query, $data);
         });
     }
 }
开发者ID:oscaragcp,项目名称:sql-logging,代码行数:32,代码来源:SqlLoggingServiceProvider.php


示例18: postRestore

 public function postRestore()
 {
     // validasi
     $input = Input::all();
     $rules = array('sql' => 'required|sql');
     $validasi = Validator::make(Input::all(), $rules);
     // tidak valid
     if ($validasi->fails()) {
         // pesan
         $sql = $validasi->messages()->first('sql') ?: '';
         return Response::json(compact('sql'));
         // valid
     } else {
         // ada sql
         if (Input::hasFile('sql')) {
             // nama sql
             $sql = date('dmYHis') . '.sql';
             // unggah sql ke dir "app/storage/restores"
             Input::file('sql')->move(storage_path() . '/restores/', $sql);
             // path file
             $file = storage_path() . '/restores/' . $sql;
             // dump database
             $dump = new Dump();
             $dump->file($file)->dsn($this->dsn)->user($this->user)->pass($this->pass);
             new Import($dump);
             // hapus file restore
             unlink($file);
             // tidak ada sql
         } else {
             // pesan
             $sql = 'Sql gagal diunggah.';
             return Response::json(compact('sql'));
         }
     }
 }
开发者ID:udibagas,项目名称:digilib,代码行数:35,代码来源:DatabaseController.php


示例19: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $database = $this->option('database') ?: $this->config->get('database.default');
     if (!is_dir(storage_path() . '/aperture')) {
         mkdir(storage_path() . '/aperture');
     }
     $selection = array();
     foreach (scandir(storage_path() . '/aperture', SCANDIR_SORT_DESCENDING) as $file) {
         if (strpos($file, $this->argument('table') . '_' . $database)) {
             $selection[] = $file;
         }
     }
     if (count($selection) === 0) {
         return $this->error('No snapshots found.');
     } elseif (count($selection) === 1) {
         $choice = 0;
     } else {
         foreach ($selection as $key => $file) {
             echo '[' . $key . '] Snapshot from ';
             $parts = explode('_', $file);
             echo date('H:i, M jS', $parts[0]) . "\n";
         }
         $choice = (int) $this->ask('Which snapshot do you want to restore from? ');
     }
     if ($this->snapshot->hasRows($database, $this->argument('table'), $this->option('chunk')) && !$this->confirm('This will clear any existing data in ' . $this->argument('table') . '. Continue? [y|N]', false)) {
         return $this->error('Restoration aborted');
     }
     $file = fopen(storage_path() . '/aperture/' . $selection[$choice], 'r');
     $this->snapshot->handle = $file;
     $this->snapshot->restore($database, $this->argument('table'), $this->option('chunk'));
     fclose($file);
     $this->info('Snapshot restored!');
 }
开发者ID:mcprohosting,项目名称:aperture,代码行数:38,代码来源:RestoreSnapshot.php


示例20: __construct

 public function __construct(Filesystem $filesystem, Definition $definition)
 {
     $this->filesystem = $filesystem;
     $this->definition = $definition;
     $this->path = storage_path('installation.json');
     $this->fetchData();
 }
开发者ID:illuminate3,项目名称:larastaller,代码行数:7,代码来源:Installation.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP store函数代码示例发布时间:2022-05-23
下一篇:
PHP stopProfile函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap