thinkphp模板页如何显示含有html标签的赋值
在后台对content赋值为
$content="<p>asfdasfdasfd<img src="/ueditor/php/upload/image/20140701/1404170233127851.png" title="1404170233127851.png" alt="login_layerBg.png"/></p>"
$this->assign("content",$content);
在前台html页面中调用content时
{$content}
显示的竟然是
<p>asfdasfdasfd<img src="/ueditor/php/upload/image/20140701/1404170233127851.png" title="1404170233127851.png" alt="login_layerBg.png"/></p>
$content="<p>asfdasfdasfd<img src="/ueditor/php/upload/image/20140701/1404170233127851.png" title="1404170233127851.png" alt="login_layerBg.png"/></p>"
$this->assign("content",$content);
在前台html页面中调用content时
{$content}
显示的竟然是
<p>asfdasfdasfd<img src="/ueditor/php/upload/image/20140701/1404170233127851.png" title="1404170233127851.png" alt="login_layerBg.png"/></p>
没有对html标签进行处理,这是怎么回事?
解决方案:
{$comment|htmlspecialchars_decode}
htmlspecialchars_decode()
函数把一些预定义的 HTML 实体转换为字符。
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇: DOM元素尺寸offsetWidth,scrollWidth,clientWidth等详解
