{{}}和{!!有什么区别? !!}在laravel刀片文件中? [英] What is the difference between {{ }} and {!! !!} in laravel blade files?
本文介绍了{{}}和{!!有什么区别? !!}在laravel刀片文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在laravel框架中,我们可以使用Blade在HTML文件中添加PHP代码.
我们在Laravel的刀片文件中同时使用了{{ }}
和{!! !!}
语法.
它们之间有什么区别?
In the laravel framework we can use blade to add PHP code in html file.
We are using both {{ }}
and {!! !!}
syntax in blade files of Laravel.
What is the difference between them?
推荐答案
如果您使用类似HTML的样式将数据从Controller传递到View,则
If you pass data from your Controller to a View with some HTML styling like:
$first = "<b>Narendra Sisodia</b>";
然后在Blade中使用{{ $first }}
对其进行访问,则输出为:
And it is accessed, within Blade, with {{ $first }}
then the output'll be:
<b>Narendra Sisodia</b>
但是,如果使用{!! $first !!}
访问它,则输出为:
But if it is accessed with {!! $first !!}
then the output'll be:
Narendra Sisodia
这篇关于{{}}和{!!有什么区别? !!}在laravel刀片文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文