Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 所见即所得编辑器转义图像url_Php_Ckeditor_Wysiwyg - Fatal编程技术网

Php 所见即所得编辑器转义图像url

Php 所见即所得编辑器转义图像url,php,ckeditor,wysiwyg,Php,Ckeditor,Wysiwyg,我使用的是CKeditor,不能使用图像。当我用它来创建帖子/文章时,添加图片之类的东西,一切都正常。然而,在我将文章提交到数据库后,它会逃逸url和语法,这将导致在我试图查看它时不会显示任何图像 这是编辑器中的img语法: <img alt="logo" src="/images/image.png" style="width: 250px; height: 183px; border-width: 2px; border-style: solid;" /> 我在显示脚本中尝试了

我使用的是CKeditor,不能使用图像。当我用它来创建帖子/文章时,添加图片之类的东西,一切都正常。然而,在我将文章提交到数据库后,它会逃逸url和语法,这将导致在我试图查看它时不会显示任何图像

这是编辑器中的img语法:

<img alt="logo" src="/images/image.png" style="width: 250px; height: 183px; border-width: 2px; border-style: solid;" />
我在显示脚本中尝试了
html\u entity\u decode
,比如
$a=html\u entity\u decode($row['Body')
然后回显该行,或者将该行分配给变量并解码。可能是我做错了,我不确定。

在显示函数中添加了stripslashes($output),如下所示:

public function display ($id) {
    $sql = $this->db->query("SELECT Body FROM Content WHERE id='$id'");
    while ($row = $sql->fetch()) {
        //removes the extra slashes
        echo stripslashes($row); 
    }
}
public function insert () {
    $sql = $this->db->prepare("INSERT INTO Content (Title, Body, category) VALUES (?, ?, ?)");
        $sql->bindParam(1, $_POST['title']);
        $sql->bindParam(2, $_POST['body']);
        $sql->bindParam(3, $_POST['category']);
        $sql->execute();
}

public function display ($id) {
    $sql = $this->db->query("SELECT Body FROM Content WHERE id='$id'");
    while ($row = $sql->fetch()) {
        echo $row;
    }
}
public function display ($id) {
    $sql = $this->db->query("SELECT Body FROM Content WHERE id='$id'");
    while ($row = $sql->fetch()) {
        //removes the extra slashes
        echo stripslashes($row); 
    }
}