问题描述
我知道您可以使用更改默认刀片分隔符
Blade::setEscapedContentTags('[[', ']]');
Blade::setContentTags('[[[', ']]]');
但是我不知道应该把它放在哪里,这样它只会影响单个刀片模板,而不是将它放在app/start/global.php
会影响整个应用程序.
如果您只想对单个视图使用不同的标签,则可以在将生成视图的闭包或控制器操作中设置标签.
Route::get('/', function()
{
Blade::setEscapedContentTags('[[', ']]');
Blade::setContentTags('[[[', ']]]');
return View::make('home');
});
如果您想在应用程序布局中使用普通标签{{
和}}
,但在嵌套视图中使用自定义标签,则可能会遇到问题-我不确定最好的方法是什么. /p>
I know that you can change the default blade delimiter using
Blade::setEscapedContentTags('[[', ']]');
Blade::setContentTags('[[[', ']]]');
However I don't know where should I put it so that it only affect single blade template as opposed to putting it at app/start/global.php
which affect whole application.
If you only want to use different tags for a single view, you can set the tags in the closure or controller action that will generate the view.
Route::get('/', function()
{
Blade::setEscapedContentTags('[[', ']]');
Blade::setContentTags('[[[', ']]]');
return View::make('home');
});
This could be an issue if you want to use the normal tags {{
and }}
in an application layout but your custom ones in a nested view - I'm not sure what the best approach there would be.
这篇关于更改Laravel刀片定界符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!