简体   繁体   中英

xamp server to wamp server error

I changed a php project from XAMP to WAMP. when i try to test the forms in project i get an error.

The error is like this

Deprecated: Function ereg() is deprecated in C:\\wamp\\www\\widephp\\includes\\functions\\general_functions.php on line 135

and the 135th line is

if(!ereg("^[a-z0-9_.]+@[a-z0-9]+\.([a-z.]{2,15})",trim($v))) {

the full part the line contains given below

foreach($fieldEmail as $v) {
    if(!ereg("^[a-z0-9_.]+@[a-z0-9]+\.([a-z.]{2,15})",trim($v))) {
        $alert = "Enter a valid Email address";
        return false;
    }
}

Can anyone help with this?

As the message indicates, the function ereg() is deprecated.

Your platform change most likely included either an upgrade in the php version, or changes in th error output, or maybe both.

From the manual :

This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

My advice: Follow the manuals advice. Use preg_match() instead. Keep in mind you have to adjust the syntax of your regex, here is the documentation of it in the php manual.

You can downgrade your PHP version (which is not appreciated) or follow the @Bjoern's answer. To downgrade PHP version on wamp:

WAMP > PHP> Version > Get more

download version under 5.3, install it and than change version:

WAMP > PHP> Version > 5.2.X

my edit was declined by @Bjoern, so i write this as an answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM