如何安全地为MySQL在PHP中转义输入数据 [英] How to safely escape the input data in php for mysql

查看:66
本文介绍了如何安全地为MySQL在PHP中转义输入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,这意味着在php中筛选数据并将其发送到mysql数据库是最安全的.

Which means, at the moment, are the safest for screening data in php to send them to the mysql database.

谢谢,您)

推荐答案

我相信 mysql_real_escape_string() mysql i _real_escape_string()是转义输入数据的最佳方法

I believe mysql_real_escape_string() mysqli_real_escape_string() is the best way to escape input data

以后所有内容均已弃用且信息必须有效,因此请稍后进行

Later edit since everything is deprecated now and information must be valid:

尝试使用 PDO ,因为准备好的语句要安全得多或

Try to use PDO as prepared statements are much safer or mysqli_*() functions if you really need to keep old code somewhat up-to-date.

这篇关于如何安全地为MySQL在PHP中转义输入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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