Home > php教程 > php手册 > body text

php mysql_escape_string与addslashes区别详解

WBOY
Release: 2016-05-25 16:47:07
Original
1355 people have browsed it

php mysql_escape_string与addslashes区别详解,大家可参考一下本文章.

mysql_real_escape_string() 函数转义 SQL 语句中使用的字符串中的特殊字符.

下列字符受影响:

•x00

•n

•r

•'

•"

•x1a

如果成功,则该函数返回被转义的字符串.如果失败,则返回 false.

addslashes() 函数在指定的预定义字符前添加反斜杠.

这些预定义字符是:

•单引号 (')

•双引号 (")

•反斜杠 ()

•NULL

区别总结

mysql_escape_string与addslashes的区别在于   

mysql_escape_string总是将"'"转换成"'"  

而addslashes   

在magic_quotes_sybase=on时将"'"转换成"''"   

在magic_quotes_sybase=off时将"'"转换成"'"


教程网址:

欢迎收藏∩_∩但请保留本文链接。

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!