手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

PHP针对HTML实体字符的转义函数

时间:2024-10-15 10:31:04

1、htmlspecialchars()转义特别的字符为HTML实体;'&'(ampersand)becomes'&amp;''"'(doublequote)becomes'&quot;'whenENT_NOQUOTESisnotset.'''(singlequote)becomes'&#039;'onlywhenENT_QUOTESisset.'<'(lessthan)becomes'&lt;''>'(greaterthan)becomes'&gt;'

2、htmlspecialchars_decode()将实体转成HTML代码,函数1的反函数。

3、htmlentities()这个是全部转换html实体,和htmlspecialchars()区别在于,这个函数是转义全部的字符,而htmlspecialchars()仅仅转义上面限定的5个特殊字符!html_entity_decode() 函数把 HTML 实体转换为字符。

© 手抄报圈