Laravel 5.0 - Blade Template Errors

后端 未结 2 1242
被撕碎了的回忆
被撕碎了的回忆 2020-12-18 00:28

Just playing about with Laravel 5, and am having difficulties using the Blade templating syntax. It appears that all my special characters are being escaped. Have I somethin

相关标签:
2条回答
  • 2020-12-18 00:47

    If you must use the old (L4.2 or less) Blade syntax, add the following lines at the bottom of AppServiceProvider@register:

    \Blade::setRawTags('{{', '}}');
    \Blade::setContentTags('{{{', '}}}');
    \Blade::setEscapedContentTags('{{{', '}}}');
    

    This should not be done lightly, and may make your application more vulnerable to XSS exploits, so use it with caution.

    0 讨论(0)
  • 2020-12-18 00:50

    In Laravel 5, {{ }} will auto escape. What you need to use now is {!! !!}.

    {!! Form::open() !!}
    
    {!! Form::close() !!}
    

    More read about the change can be seen on https://laracasts.com/discuss/channels/general-discussion/new-blade-tag-for-unescaped-data-thoughts (thanks to @user1960364).

    0 讨论(0)
提交回复
热议问题