Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何替换-为–使用 phphtmlspecialchars()
-
–
htmlspecialchars()
$content = $_POST['content'];
你没有,-不是一个特殊字符,因此不会被htmlspecialchars(). -甚至与( –- vs. -) 不同。
str_replace()如果您愿意,可以使用:
str_replace()
$content = str_replace('-', '–', $_POST['content']);