<br>嗨,即使有功能,有什么方法可以使工作htmlspecialchars。我的问题是,当我在函数htmlspecialchars中放置文本时,即使文本有新行,也没有新行。我的代码是这样的:
$text_val = "
this is a line
it is a new line
one more line
";
$final_text = str_replace("\n","<br>",$text_val);
$text = htmlspecialchars($final_text);
echo $text;
结果是这样的:
this is a line it is a new line one more line
但我希望它像第一个:
this is a line
it is a new line
one more line
感谢你们。
繁星点点滴滴
森林海