【问题标题】:Getting deprecated error even after disabling them即使在禁用它们之后也会出现不推荐使用的错误
【发布时间】:2011-07-29 21:10:09
【问题描述】:

我已经在我的 php 脚本中设置了这个:

error_reporting(E_ALL ^ E_DEPRECATED);

然而,当我运行代码时,我得到了这个:

Deprecated: Function split() is deprecated in /home/www/prog/classes/inc.general.php on line 669

这是为什么? PHP 网站提到这应该可以工作:

// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);

【问题讨论】:

  • 机器上运行的是哪个版本的 PHP? E_DEPRECATED 直到 V5.3 才引入
  • @Chet:他得到了一个Deprecated-error

标签: php error-reporting


【解决方案1】:
error_reporting(E_ALL & ~E_DEPRECATED);

在开发中,您应该启用 E_DEPRECATED 并改为修复您的代码。在生产中,您也应该禁用 E_NOTICE

还要确保您的应用程序中没有任何内容,这可能会在稍后执行期间更改您的设置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-26
    • 1970-01-01
    • 2022-01-05
    • 2015-09-22
    相关资源
    最近更新 更多