Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of php5.3 prompt Function ereg () is deprecated Error

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to solve the problem of php5.3 prompt Function ereg () is deprecated Error, which is very detailed and has certain reference value. Friends who are interested must finish it!

1. Question:

PHP 5.3ereg () does not work properly. The hint "Function ereg () is deprecated Error" is because its long ereg function is upgraded, which requires rules like preg_match to use / /. Of course, it is also the rhythm that php5.3 abolishes ereg.

PHP 5.3ereg () does not work properly, prompting "Function ereg () is deprecated Error".

The root of the problem is that there are two regular representations in php, one is posix, and the other is that perl,php6 intends to abolish the regular representation of posix, so it later added a preg_match. The solution to this problem is simple: add a filter prompt symbol before ereg: change ereg () to @ ereg (). This shields the prompts, but the fundamental problem is still unsolved. Before version 5.2 of php, ereg was used normally. After 5.3, preg_match will be used instead of ereg. So it needs to be like this.

Originally: ereg ("^ [0-9] * $", $page) becomes: preg_match ("/ ^ [0-9] * $/", $page)

Special reminder: the obvious difference between posix and perl is whether or not to add a slash, so compared with ereg, the latter adds two "/" symbols before and after the regularization, which is indispensable.

For example:

Before the change:

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); / / filter}

2. 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}

Note: be sure to add the beginning and end of'/'.

The above is all the content of the article "how to solve the problem of php5.3 prompt Function ereg () is deprecated Error". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report