把输出转义成能正常用于text类型

来源:互联网 发布:cepii距离数据怎么看 编辑:程序博客网 时间:2024/05/18 00:29

htmlspecialchars($str,ENT_QUOTES);

 

 

转义以下字符

  • '&' (ampersand) becomes '&'

  • '"' (double quote) becomes '"' when ENT_NOQUOTES is not set.

  • ''' (single quote) becomes ''' only when ENT_QUOTES is set.

  • '<' (less than) becomes '&lt;'

  • '>' (greater than) becomes '&gt;'