问题描述
我正在尝试禁用我的php.ini
文件中的E_STRICT
错误,但仍会引发错误.我正在将PHP 5.4.10
和MAMP
(不是PRO版本)一起使用.
I'm trying to disable E_STRICT
errors in my php.ini
file but it still throws the error. I'm using PHP 5.4.10
with a MAMP
(not PRO version).
使用phpinfo
我已经将php.ini
文件放置在/Applications/MAMP/bin/php/php5.4.10/conf/php.ini
With phpinfo
I've located the php.ini
file in /Applications/MAMP/bin/php/php5.4.10/conf/php.ini
我已更改:
error_reporting = E_ALL
到
error_reporting = E_ALL & ~E_STRICT
然后我重新启动了Apache
,但是它仍然抛出错误,我错了?
Then i've restarted Apache
but it still throw the error, where I'm wrong?
推荐答案
使用error_reporting = E_ALL ^ E_STRICT
.
如果您无权访问php.ini,则可以将其放在.htaccess文件中:
If you didn't have access to php.ini, you could put this in your .htaccess file:
php_value error_reporting 30711
这是E_ALL值(32767),并删除了E_STRICT(2048)和E_NOTICE(8)值.
This is the E_ALL value (32767) and the removing the E_STRICT (2048) and E_NOTICE (8) values.
如果您无权访问.htaccess文件或未启用该文件,则可以将其放在任何脚本的PHP部分的顶部
If you don't have access to the .htaccess file or it's not enabled, you can put this at the top of the PHP section of any script
error_reporting(E_ALL ^ E_STRICT)
这篇关于禁用php.ini文件中的E_STRICT错误仍然会引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!