php去除deprecated的实例方法

 2023-01-14    354  

1、找到并打开“php/php.ini”文件。

2、修改内容为“error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_WARNING”即可。

php去除deprecated的实例方法

去掉PHP的中警告(warning)、deprecate等提示的方法

打开php/php.ini:

修改

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_WARNING

知识点扩展

php Deprecated 解决办法

这个问题是因为php版本过高。

在php5.3中,正则函数ereg_replace已经废弃,而dedecms还继续用。有两个方案可以解决以上问题:

1、把php版本换到v5.3下。

2、继续使用v5.3,修改php.ini文件

;extension=php_mbstring.dll

改为

extension=php_mbstring.dll

;mbstring.func_overload = 0

修改为:

mbstring.func_overload = 7

或者使用其他的函数:

define(‘DEDEADMIN’, ereg_replace(“[/\\]{1,}”, ‘/’, dirname(__FILE__) ) );

//改为

define(‘DEDEADMIN’, preg_replace(“/[\/\\\\]{1,}/”, ‘/’, dirname(__FILE__) ) );

注:因为preg_replace比ereg_replace的执行速度快,PHP推荐使用preg_replace.

以上所述是小编给大家介绍的php去除deprecated的实例方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!

原文链接:https://77isp.com/post/25585.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。