本文整理汇总了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());
});
}