php 升级到 5.3+ 后出现的一些错误,如 ereg(); ereg_replace(); 函数报错,eregereg_replace
在php5.3环境下运行,常常会出现
Deprecated: Function ereg() is deprecated in...和Deprecated: Function ereg_replace() is deprecated in...这些类型的报错提示。
其原因在于:php5.3以上的版本不支持ereg()函数,而是使用preg_match()函数;不支持ereg_replace()函数,而使用preg_replace()函数。
解决方法:将不支持的函数修改为支持的函数即可。
例如
if(eregi('^('value', $value)
改为:
if(preg_match('/value/', $value)
再例如:
$string = ereg_replace(' value', ' ', trim($string));
改为:
$string = preg_replace('{ value}', ' ', trim($string));
解决Deprecated: Assigning the return value of new by reference is deprecated in报错
因为我们现在php是5.3的原因,在php5.3之中可以直接用”=”,而之前因为在本地上测试都是5.3以下的php环境用的是”=&”符号。
在 5.3版本之后已经不允许在程序中使用”=&”符号。如果你的网站出现了Deprecated: Assigning the return value of new by reference is deprecated in 错误,别着急,先定位到出错的文件,查找下是不是在程序中使用了”=&”,发现使用了”=&”符号,去掉‘&’符号之后程序运行 正常。
问题:Deprecated: Function set_magic_quotes_runtime() is deprecated in
导致这个提示的原因是在PHP5.3后此特性(set_magic_quotes_runtime())已经关闭。
而且在PHP6中已经完全移除此特性。
你可以注释或者删除掉出错的行,或者是在set_magic_quotes_runtime()前面加@符号

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools