Laravel 5 升级 - Blade 表单语法

Laravel 5 Upgrade - Blade Form syntax

我最近将我的项目从 4.2 升级到了 5.1。

我注意到刀片中的表单现在必须使用 {!! ... !!} 括号。

我的项目有 900 多个表单调用实例。

根据我在 laravel 网站上看到的内容,我唯一能做的就是更新我使用表单的每个标签 html 行。

这是一个明智的决定吗?请记住,我必须这样做 900 多次。

Laravel docs 声明如下:

For better security by default, Laravel 5.0 escapes all output from both the {{ }} and {{{ }}} Blade directives. A new {!! !!} directive has been introduced to display raw, unescaped output. The most secure option when upgrading your application is to only use the new {!! !!} directive when you are certain that it is safe to display raw output.

However, if you must use the old 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. Also, comments with {{-- will no longer work.

这是相对于从 4.2 升级到 5.0 而言的,但是由于从 5.0 到 5.1 的升级很小,所以这仍然适用。