【发布时间】:2018-08-20 14:14:50
【问题描述】:
我想在运行时禁止来自此trigger_error('Deprecated', E_USER_DEPRECATED); 的警告。根据我的阅读,我可以使用error_reporting(E_ALL & -E_USER_DEPRECATED & -E_DEPRECATED);。但这不起作用。如果error_reporting 使用error_reporting(0) 可以正常工作,我试过了。这行得通。我错过了什么?我没有找到另一种方法来解决我的问题。并且没有注意到这种方式对其他人不起作用。
我的代码不会抑制已弃用的警告:
error_reporting(E_ALL & -E_USER_DEPRECATED);
trigger_error('Deprecated', E_USER_DEPRECATED);
php 版本:7.0.14.
【问题讨论】:
-
我想你想要的是波浪号,试试
error_reporting(E_ALL & ~E_DEPRECATED);
标签: php error-reporting