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


PHP Blade::compiled方法代码示例

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


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

示例1: sharpen

 /**
  * Register the Blade view engine with Laravel.
  *
  * @return void
  */
 public static function sharpen()
 {
     Event::listen(View::engine, function ($view) {
         // The Blade view engine should only handle the rendering of views which
         // end with the Blade extension. If the given view does not, we will
         // return false so the View can be rendered as normal.
         if (!str_contains($view->path, BLADE_EXT)) {
             //return;
         }
         $compiled = Blade::compiled($view->path);
         // If the view doesn't exist or has been modified since the last time it
         // was compiled, we will recompile the view into pure PHP from it's
         // Blade representation, writing it to cached storage.
         if (!file_exists($compiled) or Blade::expired($view->view, $view->path)) {
             file_put_contents($compiled, Blade::compile($view));
         }
         $view->mytplengine or $view->mytplengine = new \TemplateEngine(TEMPLATEPATH);
         //kd($compiled);
         $compiled = $view->mytplengine->display($compiled, true);
         $view->path = $compiled;
         // Once the view has been compiled, we can simply set the path to the
         // compiled view on the view instance and call the typical "get"
         // method on the view to evaluate the compiled PHP view.
         return ltrim($view->get());
     });
 }
开发者ID:ycms,项目名称:theme-evo,代码行数:31,代码来源:blade.php


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