如果出现致命错误——比如无法连接到数据库,那么 PHP 会在浏览器中打印错误堆栈,如下所示——
mysql_pconnect() [<a href='function.mysql-pconnect'>function.mysql-pconnect</a>]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111
#0 /var/www/platform/db/connection.php:12 mysql_pconnect('127.0.0.1','root','password')
#1 /var/www/platform/db/front_page.php:10 open_db_connection()
#2 /var/www/platform/services/front_page_services.php:7 find_top_courses()
#3 /var/www/platform/inc/main.php:75 get_top_courses()
#4 /var/www/index.php:198 F3::run()
我该如何防止这种情况?error_reporting
inphp.ini
已设置为0
关闭display_errors
。