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

 时间:2026-04-24 01:59:46

1、htmlspecialchars()转义特别的字符为HTML实体;

    '&' (ampersand) becomes '&amp;'     '"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set.     ''' (single quote) becomes '&#039;' only when ENT_QUOTES is set.     '<' (less than) becomes '&lt;'     '>' (greater than) becomes '&gt;' 

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

3、htmlentities()

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

html_entity_decode() 函数

把 HTML 实体转换为字符。

  • 五个国家的小学生午餐
  • 糊糊,不登大雅之堂的健康美食(陡势横桥)
  • 简单易做的徐州特色锅贴--牛肉锅贴
  • 低烧不退是什么原因
  • 办公桌摆什么植物最好
  • 热门搜索
    辣椒怎么腌制好吃 乐怎么读 脚后跟疼是怎么回事 肝脏不好怎么调理 米饭怎么蒸 亲爱的用英语怎么说 怎么创建微信公众号 喝咖啡睡不着怎么办 中秋节的作文怎么写 苹果手机掉水里怎么处理