thinkphp 防sql注入

  1. $Model->where("id=%d and username='%s' and xx='%f'",array($id,$username,$xx))->select();
强制转换变量类型,防止sql注入。
%d - double,包含正负号的十进制数(负数、0、正数)
%s - string,字符串
%f - float,浮点数
原文地址:https://www.cnblogs.com/zjdeblog/p/6163923.html