Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
332 views
in Technique[技术] by (71.8m points)

php7无法开启报错提示

版本:php7.3.11
环境:macOS 10.15.4
问题:网页报错500,因为是开发环境,希望页面实时展示错误信息

当前php.ini:

display_errors
  Default Value: On
  Development Value: On
  Production Value: On

; display_startup_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

error_reporting
  Default Value: E_ALL
  Development Value: E_ALL
  Production Value: E_ALL

; html_errors
;   Default Value: On
;   Development Value: On
;   Production value: On

log_errors
  Default Value: On
  Development Value: On
  Production Value: On

在我们的工程中,所有文件的开头都会引用如下代码:

defined('DEBUG') or define('DEBUG', true);
defined('YII_DEBUG') or defined('YII_DEBUG', true);
defined('YII_ENV') or defined('YII_ENV', 'dev');
error_reporting(E_ALL);
if (DEBUG)
{
    ini_set('display_errors', 'On');
}
else
{
    ini_set('display_errors', 'Off');
}

现在:
image.png

我预期的样子:
WechatIMG4.jpeg


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

看你用的是yii的框架把,可以看看错误处理页面如何定义:

https://www.yiichina.com/doc/...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...