简体   繁体   中英

What's wrong with header location in eregi PHP

$page=curl_exec ($ch); 

if(eregi('EXP', $page)){
    header("location: https://www.facebook.com");
}

My probleme is with the header location not working

What exactly isn't working? Is it showing an error message or just not forwarding? Check your regex at regex101.com .

eregi() was deprecated and removed so if you're using a more recent version of PHP, it would probably completely error out. You can try using preg_match() instead.

I'm not 100% sure if it's case-sensitive, but I've always seen and used Location: with a capital L .

It's also generally a good idea to exit after you use a location redirect header:

header("Location: https://www.facebook.com");
exit;

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