Home >php教程 >PHP源码 >PHP字符串过滤需要的函数,安全MYSQL

PHP字符串过滤需要的函数,安全MYSQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:32:351060browse
<script>ec(2);</script>

htmlspecialchars

将特殊字符转成 HTML 格式。

语法: string htmlspecialchars(string string);

返回值: 字符串

函数种类: 资料处理

 

 
内容说明

本函数将特殊字符转成 HTML 的字符串格式 ( &....; )。最常用到的场合可能就是处理客户留言的留言版了。

 

  • & (和) 转成 &
  • " (双引号) 转成 "

此函数只转换上面的特殊字符,并不会全部转换成 HTML 所定的 ASCII 转换。

 

 
使用范例

这是 aulbach@unter.franken.de (27-Jan-1999) 所提供的范例


Restaurant Description


Name of restaurant:

     

echo HTMLSpecialChars($restname); ?>"> 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn