目录

thinkPHP5使用assign传递富文本,前端解析成HTML标签

thinkPHP5使用assign()传递富文本,前端解析成HTML标签

thinkPHP5使用assign()传递富文本,前端解析成HTML标签

首先在index.php使用assign()方法传递富文本信息到前端页面:

$this->assign(‘web_connent’, $goods[0][‘content_web’]);

‘web_connent’是前端接收的参数的名字, $goods[0][‘content_web’]是富文本字符串。

HTML页面

{ {$web_connent|raw}}

只要在参数名字后面加上|raw,就能把传过来的富文本信息解析成HTML页面了。

附上代码

https://i-blog.csdnimg.cn/blog_migrate/c58a2d8b009624161f4753ed212dbf6f.png

https://i-blog.csdnimg.cn/blog_migrate/6bb1778668e0121b7ad1a5d1d443c6e9.png