Home > Backend Development > PHP Tutorial > PHP error message: Deprecated: Function eregi() is deprecated_PHP tutorial

PHP error message: Deprecated: Function eregi() is deprecated_PHP tutorial

WBOY
Release: 2016-07-13 10:57:05
Original
1073 people have browsed it

Today when using a regular expression, I got an error message: Deprecated: Function eregi() is deprecated in. Later I found out that the reason is that our php5.3 does not support the eregi function in 5.3. You can use preg_match directly instead. .

Before changed: 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); // 进行过滤
}

Solution:

Find the file location where the code is located


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) ; // Filter
}
The code is as follows
 代码如下 复制代码


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); // 进行过滤
}

Copy code

Note: Be sure to add '/' at the beginning and end. http://www.bkjia.com/PHPjc/632111.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/632111.html
TechArticle
Today when using a regular expression, it prompted an error message Deprecated: Function eregi() is deprecated in. Later I found out the reason. This is our php5.3. The eregi function is no longer supported in 5.3. You can directly...
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template