PHP中addslashes与mysql_escape_string的区别分析_php技巧

WBOY
Release: 2016-05-16 19:53:41
Original
1517 people have browsed it

本文实例分析了PHP中addslashes与mysql_escape_string的区别。分享给大家供大家参考,具体如下:

1.在插入数据时两者的意义基本一样.区别只在于addslashes

在magic_quotes_sybase=on时将“ '”转换成“ ' '”

在magic_quotes_sybase=off时将“ '”转换成“ '”

而mysql_escape_string总是将“ '”转换成“ '”

2.mysql_escape_string在php6中将被抛弃,所以最好避免用它.

而且最好用面向对象的mysqli::real_escape_string,

如果非要用面向过程的话可以用mysql_real_escape_string

更多关于PHP相关内容感兴趣的读者可查看本站专题:《PHP数据结构与算法教程》、《PHP运算与运算符用法总结》、《PHP网络编程技巧总结》、《PHP基本语法入门教程》、《php操作office文档技巧总结(包括word,excel,access,ppt)》、《php日期与时间用法总结》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总

希望本文所述对大家PHP程序设计有所帮助。

Related labels:
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 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!