0

可能重复:
不推荐使用函数 eregi()

你好我收到这个错误

已弃用:函数 eregi() 在第 4 行的 /home/u578804202/public_html/includes/functions.php 中已弃用

这是我的代码:

if(eregi($file,$_SERVER['REQUEST_URI'])) {
    die("Sorry but you cannot access this file directly for security reasons.");
}
4

2 回答 2

0

正如您应该的那样,它是一个已弃用的旧功能,stristr()而是用户

if(stristr($_SERVER['REQUEST_URI'],$file)) {
    die("Sorry but you cannot access this file directly for security reasons.");
}
于 2013-01-26T02:17:32.397 回答
0

您应该preg_match改用:

if (!preg_match("~{$file}~i,", $_SERVER['REQUEST_URI'])) {
    die("Sorry but you cannot access this file directly for security reasons.");
}
于 2013-01-26T02:26:02.230 回答