在后台对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 实体转换为字符。