Ahm*_*gha 11 php zend-framework error-reporting
我在zend框架中报告错误时遇到问题,错误消息没有显示在浏览器上,我发现错误是这样的:
发生错误
应用程序错误
但是我已经在我的application.ini文件中使用了这些配置:
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
phpSettings.track_errors = 1
phpSettings.error_reporting = E_ALL
Run Code Online (Sandbox Code Playgroud)
提前致谢
who*_*ton 13
你提到的设置是php错误管理,而你正在寻找的是Zend错误和异常报告.正如kjy112所提到的,看起来Zend默认为生产环境,它不会显示任何错误报告.
Zend快速入门可能是帮助您快速掌握此问题的最快方法:http: //framework.zend.com/manual/en/zend.application.quick-start.html
基本上你可以在index.php文件中设置一个define(不是最干净的),或者我建议你在apache配置中设置它,然后从index.php文件中读取它.我在我的Bootstrap中使用这样的东西:
if (!defined('APPLICATION_ENVIRONMENT'))
{
if (getenv('APPLICATION_ENVIRONMENT')) {
define('APPLICATION_ENVIRONMENT', getenv('APPLICATION_ENVIRONMENT'));
} else {
define('APPLICATION_ENVIRONMENT', 'production');
}
}
Run Code Online (Sandbox Code Playgroud)
默认的Zend error.phtml视图类似于以下代码,它阻止生产环境中的显示:
<?php if ('production' !== $this->env): ?>
<div id="error">
<p>
<ul class="errorList">
<li>
<h3><?php echo $this->message ?></h3>
</li>
<li>
<h4>Exception information:</h4>
<p><?php echo $this->exception->getMessage() ?></p>
</li>
<li>
<h4>Stack trace:</h4>
<p><?php echo $this->exception->getTraceAsString() ?></p>
</li>
<li>
<h4>Request Parameters:</h4>
<p><?php var_dump($this->request->getParams()) ?></p>
</li>
</ul>
</p>
</div>
<?php endif ?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16380 次 |
| 最近记录: |