开发者

Automatically replace "&" with "&" [duplicate]

开发者 https://www.devze.com 2023-03-24 21:04 出处:网络
This question already has an answer here: Closed 11 years ago. Possible Duplicate: replace & for &
This question already has an answer here: Closed 11 years ago.

Possible Duplicate:

replace & for &

For a wordpress page to be v开发者_开发知识库alidated, all & should be replaced with & I know java but i do not know PHP. So how do i do this in wordpress?


Use htmlspecialchars before printing:

$text = htmlspecialchars($text)


You can escape ampersands & as well as quotes and brackets using the htmlspecialchars() function.


Like the others said, htmlspecialchars() works. Also check out htmlentities() which has a broader range of characters to replace for further scrubbing of the string.

0

精彩评论

暂无评论...
验证码 换一张
取 消