【发布时间】:2019-10-03 11:03:18
【问题描述】:
我在我的代码中使用 PDO 和准备好的语句,我想知道如何更好地输出我的数据,因为我也在使用 WYSIWYG 编辑器。 使用 strip_tags、htmlentities 或 htmlspecialchars 无法正确显示文本样式。
下面是向数据库输入数据的代码:
$sql = "INSERT INTO posts(post_title, post_content, post_author, post_category, post_tags, post_image)";
$sql .= "VALUES(:title, :content, :author, :category, :tags, :image)";
$stmt = $dbConn->prepare($sql);
$result = $stmt->execute([
':title' => $postTitle,
':content' => $postContent,
':author' => $postAuthor,
':category' => $postCategory,
':tags' => $postTags,
':image' => $imageFullName
]);
【问题讨论】:
-
输出与PDO有什么关系?您只向我们展示了插入代码。怎么输出?
-
输出我正在使用 htmlentities:
标签: php strip-tags