php Function eregi() is deprecated 解决方案
首先说下ereg()与eregi()的区别:
ereg()字符串对比匹配函数,区分字符串大小写;
eregi()字符串对比匹配函数,不区分字符串大小写.
这两个函数在php正则里经常会用到,但是由于php5.3以后的版本不再支持此函数,如果使用此函数会报:Function eregi() is deprecated的错误。如果在php5.3及更高版本使用正则的话,使用preg_match()函数即可。
这是因为php5.3起不再支持eregi()函数,而推荐使用preg_match()函数替代。
解决的方法是:将eregi()函数替换成preg_match() 函数。
if(eregi('^test',$file))
可以替换为
if(preg_match('/^test/i',$file))
您可能感兴趣的文章:
php Function eregi() is deprecated 解决方案
php错误提示:Deprecated: Function eregi() is deprecated
如何解决php Function split() is deprecated 的问题
Deprecated: Function set_magic_quotes_runtime() is deprecated
PHP错误Deprecated: Assigning the return value of new
php提示Deprecated: Directive 'register_globals' is deprecated in PHP 5.3解决办法
php Deprecated: Function set_magic_quotes_runtime() is deprecated错误
php获取访问者操作系统的代码
Deprecated: Function set_magic_quotes_runtime()
Deprecated: Function session_register() is deprecated解决办法