mysql_real_escape_string()做什么,addslashes()不做什么? [英] What does mysql_real_escape_string() do that addslashes() doesn't?

查看:95
本文介绍了mysql_real_escape_string()做什么,addslashes()不做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我们需要特定于数据库的功能,例如mysql_real_escape_string()? addlashes()不能做什么?

Why do we need a DB-specific functions like mysql_real_escape_string()? What can it do that addslashes() doesn't?

暂时忽略使用参数化查询的高级替代方法的是,一个仅使用addlashes()的web应用仍然容易受到SQL注入的攻击,如果可以,怎么办?

Ignoring for the moment the superior alternative of parameterized queries, is a webapp that uses addslashes() exclusively still vulnerable to SQL injection, and if yes, how?

推荐答案

在处理多字节编码的字符串时,加号通常不够好.

Addslashes is generally not good enough when dealing with multibyte encoded strings.

这篇关于mysql_real_escape_string()做什么,addslashes()不做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆