如何将富文本编辑器内容,以普通字符展示出来

需求
X现在需要一个功能,就是用户协议和支付协议已经html页面展示出来,显示是htm了,但是展示出来是以普通字符展示出来....
操作
使用php函数中htmlspecialchars_decode。
这个htmlspecialchars_decode - 将特殊的HTML实体转换回普通字符
代码

 /**
     * 商户入驻协议
     */
    public function agreement(){
        $id = input("id");
        $data = ["id"=>$id,'is_del'=>1];
        $content = DB::name("tb_notices")->where($data)->value('content');
        $content = htmlspecialchars_decode($content);
        $this->assign(['content'=>$content]);
        return $this->fetch();
    }

相反以普通字符转出html
需要这个函数:此函数的作用和 htmlspecialchars() 刚好相反。它将特殊的HTML实体转换回普通字符。
最后附上一个网址验证;链接

猜你喜欢

转载自blog.csdn.net/qq_29202427/article/details/81541378