Home > php教程 > php手册 > php错误提示:Deprecated: Function eregi() is deprecated

php错误提示:Deprecated: Function eregi() is deprecated

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:57:03
Original
1847 people have browsed it

今天在利用一个正则时提示Deprecated: Function eregi() is deprecated in错误了,后来查询了一原因是我们php5.3,在5.3中己经不支持eregi函数了,可以直接使用preg_match来代替。

改前:function inject_check($sql_str) {

 代码如下 复制代码
 $sql_str = strtolower($sql_str);
 return eregi('fopen|post|eval|select|insert|and|or|update|delete|'|/*|*|../|./|union|into|load_file|outfile', $sql_str); // 进行过滤
}

解决方法:

找到代码所在的文件 位置

 代码如下 复制代码


function inject_check($sql_str) {
 $sql_str = strtolower($sql_str);
 return preg_match('/fopen|post|eval|select|insert|and|or|update|delete|'|/*|*|../|./|union|into|load_file|outfile/', $sql_str); // 进行过滤
}

注意:一定要加'/'开头与结束哦。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template