tp是如何解决sql注入的
tp解决sql注入的方法:
1.系统底层对于数据安全方面本身进行了相应的防范机制,例如:
$User = M("User"); // 实例化User对象
$User->find($_GET["id"]);
2.查询条件进行预处理,where方法使用字符串条件时,进行安全过滤,并支持两种方式传入预处理参数,例如:
$Model->where("id=%d and username='%s' and xx='%f'",array($id,$username,$xx))->select();
// 或者
$Model->where("id=%d and username='%s' and xx='%f'",$id,$username,$xx)->select();
版权声明
本文仅代表作者观点,不代表米安网络立场。
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。