雅虎群组

雅虎群组 >  其他 >  应用开发专区 >  论坛 

大家来一起探讨探讨php开发中常用的防止SQL注入的方法吧

2008-04-14 16:15

我先来说一个我平时常用的

PDO(PHP Data Objects Layer)
PHP5出来的东西,对底层数据库操作进行了封装,可以采用类似于java中的prepareStatement的方式来参数化SQL语句从而达到防止SQL注入的问题。大家还有什么更好的方法吗?希望大家分享一下~

 

回复此帖 收藏此帖

2008-05-16 15:01
无语了,你发贴发到这来了,汗!

Description

string mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier ] )

Escapes special characters in the unescaped_string, taking into account the current character set of the connection so that it is safe to place it in a mysql_query(). If binary data is to be inserted, this function must be used.

mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.

This function must always (with few exceptions) be used to make data safe before sending a query to MySQL.



回复此帖

提醒:您还没有登录Yahoo!,请先登录后再发表回帖;如果您还没有Yahoo! ID,请点击此处注册
雅虎群组仅提供信息存储空间服务,其内容均由服务对象提供。
根据《信息网络传播权保护条例》,部分内容可能应权利人通知未予显示,请点击这里查看。
关于雅虎 | 帮助中心 | 使用须知 | 诚聘英才 | 广告服务 | 搜索竞价 | 网络实名 | 中文上网 | 网站联盟 [更多]
Yahoo.com.cn © 2008 版权所有 不得转载 京ICP证000022号
阿里巴巴集团 - 阿里巴巴网络:中国站 国际站 日文站 | 淘宝站 | 支付宝 | 中国雅虎 | 口碑网 | 阿里软件 | 阿里妈妈