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


PHP storage_path函数代码示例

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


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


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