如何关闭PHP注意事项?

Notice: Constant DIR_FS_CATALOG already defined

我已经注释掉display_errors的php.ini,但不能正常工作。


如何使PHP不向浏览器输出此类信息?


更新


我放在display_errors = Off那里,但它仍在报告此类通知,


这是PHP 5.3的问题吗?


也报告大量调用堆栈。


素胚勾勒不出你
浏览 367回答 3
3回答

守着星空守着你

您可以设置display_errors为0或使用该error_reporting()功能。但是,通知很烦人(我可以部分同情),但它们是有目的的。您不应该定义两次常量,第二次将不起作用,并且常量将保持不变!

翻过高山走不出你

从PHP文档(error_reporting):<?php// Turn off all error reportingerror_reporting(0);?>该功能的其他有趣选项:<?php// Report simple running errorserror_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.inierror_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 errorserror_reporting(-1);// Same as error_reporting(E_ALL);ini_set('error_reporting', E_ALL);?>

达令说

对于命令行php,设置error_reporting = E_ALL & ~E_NOTICE在 /etc/php5/cli/php.iniphp然后,命令执行将省略通知。
打开App,查看更多内容
随时随地看视频慕课网APP