如何在laravel 4之类的刀片中注释代码? [英] How to comment code in blades like laravel 4?

查看:65
本文介绍了如何在laravel 4之类的刀片中注释代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将我的应用程序从laravel 4.2迁移到了laravel 5

I have migrated my app from laravel 4.2 to laravel 5

即使我有这样的旧评论,我目前也遇到这个问题:

I am currently having this problem, when even I have old comments like this:

{{--{{link_to_route('language.select', 'English', array('en'))}}--}}

在laravel 5处将导致错误,我将遇到此错误:

Will result into error at laravel 5, I will have this error:

FatalErrorException in 18b6386ebc018eb0c0e76f105eba4286 line 263:
syntax error, unexpected '{'

被编译为:

 <?php echo --{{link_to_route('language.select', 'English', array('en')); ?>--}}

我已经在register @ ServiceProvider中添加了laravel 4向后可比性支持,如下所示:

I already added laravel 4 backward comparability support at register@ServiceProvider as:

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

但是如何为评论{{-- --}}添加laravel 4向后可比性?

but how can I add laravel 4 backward comparability for comments {{-- --}} ?

如何在laravel 5中对此进行评论:

how to comment this in laravel 5:

<li {{ (Request::is('/') ? ' class="active"' : '') }}><a href="{{{ URL::to('') }}}">{{trans('messages.Home')}}</a></li>

推荐答案

由于您已将内容标签从{{更改为{{{,因此注释标签现在是{{{--而不是{{--

Since you change your content tags from {{ to {{{ comment tags are now {{{-- not {{--

这篇关于如何在laravel 4之类的刀片中注释代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆