php5.3 hint Function ereg () is deprecated error problem resolution, eregdeprecated
This example describes the php5.3 hint function ereg () is deprecated error problem resolution method. Share to everyone for your reference. The implementation method is as follows:
First, the question:
PHP 5.3 ereg () does not work properly, prompting "function ereg () is deprecated Error" because it has a long ereg function to upgrade processing, need to like preg_match use//to rule, Of course, it is also the rhythm of php5.3 ereg to waste.
PHP 5.3 ereg () does not work properly, prompting "Function ereg () is deprecated Error".
The problem is that there are two regular representations in PHP, one is POSIX, and the other is a regular representation of PERL,PHP6 's intention to abolish POSIX, so it adds a preg_match later. The solution to this problem is simple, add a filter cue message symbol before Ereg: Turn ereg () into @ereg (). This blocked the hint message, but the fundamental problem is not resolved, PHP in the 5.2 version before the use of normal ereg, after 5.3, it is necessary to use Preg_match to replace Ereg. So it needs to be this way.
Original: Ereg ("^[0-9]*$", $page) became: Preg_match ("/^[0-9]*$/", $page)
Special reminder: The obvious difference between POSIX and Perl is whether or not to add slashes, so compared with Ereg, the latter added two "/" symbols to the regular before and after, not missing.
For example:
Before change:
Copy the Code code as follows: 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); To filter
}
Second, the solution:
Locate the file where the code is located:
Copy the Code code 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); To filter
}
Note: Be sure to add '/' to the beginning and end . This section reference: http://www.bkjia.com/article/38857.htm
Supplement: This issue does not occur in versions prior to php5.2.
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/910600.html www.bkjia.com true http://www.bkjia.com/PHPjc/910600.html techarticle php5.3 hint Function ereg () is deprecated error problem resolution, eregdeprecated This example describes the php5.3 hint function ereg () is deprecated Error problem resolution method. Share to the big ...