/** * 防止sql注入自定义方法 * author: xiaochuan * @param: mixed $value 参数值 */ function check_param($value=null) { # select|insert|update|delete|\‘|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile $str = ‘select|insert|and|or|update|delete|\‘|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile‘; if(!$value) { exit(‘没有参数!‘); }elseif(eregi($str, $value)) { exit(‘参数非法!‘); } return true; }
原文:https://www.cnblogs.com/shenchanglu/p/11518051.html