問題描述
我一直在使用 Zend Framework 并且遇到這個問題有一段時間了,但現在它變得太煩人了,所以我將問題發送給您.
I've been using Zend Framework and just living with this problem for a while, but it's now just gotten too annoying so i'll send the question out to you.
Zend 可以識別 Zend 框架內的某些問題(例如調用不存在的控制器),并將該問題發送到 ErrorController.我的工作正常.
There are certain problems within the Zend framework that Zend can recognize (such as calling a nonexistent controller), and will send that problem to the ErrorController. I've got that working fine.
似乎有一些問題,Zend Framework 會失敗并通過 php 顯示錯誤,例如某個函數不存在或什么的.那些我可以看到并修復的.
There seem to be some problems that Zend Framework will fail and display the error through php, like if a certain function doesn't exist or something. Those I can see and fix.
雖然有時 Zend 不會失敗,但它也只會發送一個空響應.我會得到一個空白頁.他們的布局沒有顯示,沒有代碼,沒有任何東西可以讓我知道出了什么問題.上次,有一個 require() 失敗了.我不得不在沒有反饋的情況下手動解決這個問題.
Sometimes though, Zend won't fail, but it will also just send out an empty response. I will get a blank page. They layout doesn't show up, there's no code, there's no nothing to give me an idea of what's gone wrong. Last time, there was a require() that failed. I had to manually figure this out with no feedback.
大家有沒有遇到過這種情況?您對如何顯示這些錯誤有什么建議嗎?任何幫助將不勝感激!
Have any of you experienced this? Do you have any advice on how to get these errors to show? Any help would be appreciated!
推薦答案
框架的 MVC 組件的內部錯誤處理只能捕獲異常,不能捕獲 PHP 錯誤.
The internal error handling of the framework's MVC components can only trap Exceptions, not PHP errors.
為了在開發過程中協助調試,可以使用標準:
To assist in debugging during development, you can use the standard:
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 'on');
此外,如果您使用的是 1.8 附帶的新自動加載器,請使用:
Also, if you're using the new Autoloader included with 1.8, use:
Zend_Loader_Autoloader::getInstance()->suppressNotFoundWarnings(false);
允許發出失敗的包含/要求語句.
To allow failed include/require statements to be issued.
這篇關于使用 Zend 框架時顯示 php 錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!