开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜