Php 所见即所得编辑器转义图像url
我使用的是CKeditor,不能使用图像。当我用它来创建帖子/文章时,添加图片之类的东西,一切都正常。然而,在我将文章提交到数据库后,它会逃逸url和语法,这将导致在我试图查看它时不会显示任何图像 这是编辑器中的img语法: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;" /> 我在显示脚本中尝试了
<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);
}
}