【发布时间】:2014-05-27 07:21:26
【问题描述】:
我目前正在尝试使用 TinyMCE 设置评论系统,它可以使用普通字符和 PHP 标记等。但是当我用这个ed o'neill 发表评论时,它只会在我的数据库中插入一个空行。
我的表单输入中有htmlspecialchars 和mysqli_real_escape_string。
如何修复空行插入?
$post_content = $_POST['post_content'];
//$post_content = htmlspecialchars($post_content);
//$post_content = mysqli_real_escape_string($post_content);
【问题讨论】:
-
你能告诉我们你的代码吗?
-
它的 2014 年,真的更好地使用现代库来使用 Mysql 或查看@PDO
-
有代码,大概 10 秒钟,然后就消失了。
-
Always use contextual escaping.。
htmlspecialchars与这里无关——它是为了防止 XSS 攻击。您只需要单独转义特殊字符。为此,请使用m_r_e_s()单独 或使用准备好的语句(首选选项)。 -
我仍然是 php 的“新手”,准备好的语句是什么意思?喜欢面向对象?或