Notice: Constant DIR_FS_CATALOG already defined
我已经在php.ini
中注释掉了display_errors
,但它不起作用。
如何使PHP不将这些内容输出到浏览器?
更新
我把display_errors = Off
放在那里,但它仍然在报告这样的通知,
这是PHP 5.3的一个问题吗?
报告大量调用堆栈也..
发布于 2010-05-19 23:43:40
您可以将display_errors
设置为0
或使用error_reporting()
函数。
然而,通知很烦人(我可以partly sympathize),但它们是有目的的。你不应该定义一个常量两次,第二次将不起作用,常量将保持不变!
发布于 2010-05-19 23:43:59
从PHP文档(error_reporting):
<?php
// Turn off all error reporting
error_reporting(0);
?>
该函数的其他有趣选项:
<?php
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL & ~E_NOTICE);
// For PHP < 5.3 use: E_ALL ^ E_NOTICE
// Report all PHP errors (see changelog)
error_reporting(E_ALL);
// Report all PHP errors
error_reporting(-1);
// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
?>
发布于 2011-11-05 22:51:59
对于命令行php,设置
error_reporting = E_ALL & ~E_NOTICE
在/etc/php5/cli/php.ini
中
然后,执行命令php
将省略这些通知。
https://stackoverflow.com/questions/2867057
复制相似问题