當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。