Php 关于折旧埃雷吉的错误
这就是我收到的错误Php 关于折旧埃雷吉的错误,php,Php,这就是我收到的错误 Deprecated: Function eregi() is deprecated in /home/socia125/public_html/profile.php on line231 这是我的密码 // Loop through the array of user agents and matching operating systems foreach($OSList as $CurrOS=>$Match) {
Deprecated: Function eregi() is deprecated in /home/socia125/public_html/profile.php on
line231
这是我的密码
// Loop through the array of user agents and matching operating systems
foreach($OSList as $CurrOS=>$Match) {
// Find a match
if (eregi($Match, $agent)) {
break;
感谢您提供的任何帮助从5.3开始,eregi()已被弃用。
你可以忽略这一点,因为这只是一个警告
我建议改为使用preg_match()
请参见链接使用
preg_match
而不是eregi
但它所做的似乎只是搜索字符串,因此您可以使用stripos
// Loop through the array of user agents and matching operating systems
foreach($OSList as $CurrOS=>$Match) {
// Find a match
if (stripos($Match, $agent) !== FALSE ) {
break;
我不能保证它能正常工作,因为我们没有看到所有的代码(特别是$Match
和$agent
的内容和示例值)
从PHP 5.3.0开始,此函数已被弃用。依靠这个
这项功能非常不受欢迎
改用。不过要小心一点,因为您无法将搜索模式1:1从转换为
显示差异的示例:
$t = "this is a test...";
if (preg_match("/test/i", $t)) echo "match!";
if (eregi('test', $t)) echo "match!";
php手册中有一个专门介绍PCRE语法的文档
但是,如果你只是想找到一个字符串,使用类似的或更快的和更容易使用的。
帮助= =它只是一个警告,但是你应该考虑用PCRE ReXEX替换POSIX正则表达式:我发现一个修复不确定它是否安全地使用/ /循环通过用户代理的数组和匹配的操作系统。($OSList as$CurrOS=>$Match){//如果(!stristr($Match,$agent)){break;