带ENT_引号的PHP换行符br

带ENT_引号的PHP换行符br,php,mysql,break,Php,Mysql,Break,是否可以使用ENT_引号,并且仍然使用任何方法来断线 $title = htmlentities($_REQUEST['title'], ENT_QUOTES); 当我在字段中输入时,例如: <input type="text" value="Teacher: Don't cheat at the exam<br /> 1. Rule<br /> 2. Rule<br /> 3. Rule"> 但我明白了: Teacher: Don't c

是否可以使用ENT_引号,并且仍然使用任何方法来断线

  $title = htmlentities($_REQUEST['title'], ENT_QUOTES);
当我在字段中输入时,例如:

<input type="text" value="Teacher: Don't cheat at the exam<br /> 1. Rule<br /> 2. Rule<br /> 3. Rule">
但我明白了:

Teacher: Don't cheat at the exam<br /> 1. Rule<br /> 2. Rule<br /> 3. Rule
老师:考试时不要作弊
1。规则2。规则3。统治

有人能帮我吗?

htmlentities()的本质是将某些字符转换为HTML实体,这包括
变成
ENT\u引号
与此处无关

因此,如果您使用
htmlentities()
过滤输入(不确定是否应该,也可能应该指定
$\u POST
等),如果希望HTML工作,则应使用相反的函数输出:

例如:

$title = htmlentities($_POST['title']);
...
echo html_entity_decode($title); // outputs proper HTML

但是没有更多的上下文,这个例子毫无意义,几乎可以肯定,在你的项目中有更好的方法来实现这一点。

当我尝试你的代码时,结果是
老师:不要在考试中作弊
1。规则2。规则3。规则
。您是否在实际代码中使用了
strip\u tags()
?输入值中没有引号,因此
ENT\u引号
没有区别。它仍然将
转换为
。是的,很遗憾我得到了同样的结果。Im hoppeless:S我不知道发生了什么?如果您希望将

元素呈现为换行符,则不应使用
htmlentities()
。该函数的全部作用是防止任何HTML标记被处理。
$title=htmlentities($\u REQUEST['title',entu QUOTES)$description=htmlentities($_请求['description'],ENT_引号);mysql_查询(“插入funn集合ac1='$ac1',ac2='po',ac3='po',imglink='$imglink',title='$title',description='$description',publisher='$name',published='$published')或死亡(“您的数据无法保存”。mysql_error())
在添加this'或this'时不使用ENT_引号,而不是代码get的sql注入…我想使用ENT_引号并无论如何使用break?您不应该使用htmlentities()进行MySQL输入清理。最好的方法是使用准备好的语句(我个人喜欢PHP MySQLiDB,这是一个利用它们并使编写某些查询更容易的库)。
$title = htmlentities($_POST['title']);
...
echo html_entity_decode($title); // outputs proper HTML