當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BladeCompiler::compile方法代碼示例

本文整理匯總了PHP中Illuminate\View\Compilers\BladeCompiler::compile方法的典型用法代碼示例。如果您正苦於以下問題:PHP BladeCompiler::compile方法的具體用法?PHP BladeCompiler::compile怎麽用?PHP BladeCompiler::compile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\View\Compilers\BladeCompiler的用法示例。


在下文中一共展示了BladeCompiler::compile方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: compile

 public function compile($path = null)
 {
     if (str_contains($path, 'vendor/')) {
         preg_match('~/vendor/\\w+/([^/]+)~', $path, $matches);
         preg_match('~/([^/]+)$~', $path, $matches2);
         $name = $matches[1] . '::' . $matches2[1];
     } elseif (str_contains($path, 'resources/views/')) {
         $name = explode('resources/views/', $path)[1];
     } else {
         $name = explode('/views/', $path)[1];
     }
     $record = CoverageRecord::RecordEntry('View', '', $name);
     parent::compile($path);
 }
開發者ID:klsandbox,項目名稱:laravelcoveragereport,代碼行數:14,代碼來源:CoverageBladeCompiler.php

示例3: fire

 public function fire()
 {
     $app = app();
     $cache = $app['path.storage'] . '/views';
     $compiler = new BladeCompiler($app['files'], $cache);
     // delete compiled
     $files = new \GlobIterator(TEMP_PATH . '/views/*');
     foreach ($files as $file) {
         if ($file->getExtension() !== '.gitignore') {
             unlink($file);
         }
     }
     // generate new ones
     $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(VIEWS_PATH), \RecursiveIteratorIterator::SELF_FIRST);
     foreach ($files as $file) {
         if ($file->getExtension() === 'blade') {
             $compiler->compile($file->getPathname());
         }
     }
 }
開發者ID:stanmay,項目名稱:unflare,代碼行數:20,代碼來源:CompileViews.php

示例4: compile

 /**
  * Compile the view at the given path.
  *
  * @param string $path
  * @return void 
  * @static 
  */
 public static function compile($path = null)
 {
     \Illuminate\View\Compilers\BladeCompiler::compile($path);
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:11,代碼來源:_ide_helper.php


注:本文中的Illuminate\View\Compilers\BladeCompiler::compile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。