如图:在页面中显示的就是原代码。还有文章中的
和
标签页都输出到页面了。
用{{ $str }}输出一个html片段,也会直接输出字符串".....",而不会变成下拉列表。
用的是laravel5.1框架,blade模板引擎。求解啊!!
是不是页面返回的不是html的类型
可以看看html源码被输出的外面是被什么包着。刚看{{ }}还以为是angularjs呢
主要是str到底是什么内容
根据官网的说明Blade Templates
Displaying Unescaped Data
By default, Blade {{ }} statements are automatically sent through PHP's htmlentities function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax:
Hello, {!! $name !!}.
Note: Be very careful when echoing content that is supplied by users of your application. Always use the double curly brace syntax to escape any HTML entities in the content.
默认情况下,变量会使用php的htmlentities进行转义处理以防止XSS攻击。如果不想转义,使用下面的{!! $list['article'] !!}试试。