問題描述
我一直在使用 Zend Framework 并且遇到這個(gè)問題有一段時(shí)間了,但現(xiàn)在它變得太煩人了,所以我將問題發(fā)送給您.
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 可以識(shí)別 Zend 框架內(nèi)的某些問題(例如調(diào)用不存在的控制器),并將該問題發(fā)送到 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 會(huì)失敗并通過 php 顯示錯(cuò)誤,例如某個(gè)函數(shù)不存在或什么的.那些我可以看到并修復(fù)的.
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.
雖然有時(shí) Zend 不會(huì)失敗,但它也只會(huì)發(fā)送一個(gè)空響應(yīng).我會(huì)得到一個(gè)空白頁.他們的布局沒有顯示,沒有代碼,沒有任何東西可以讓我知道出了什么問題.上次,有一個(gè) require() 失敗了.我不得不在沒有反饋的情況下手動(dòng)解決這個(gè)問題.
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.
大家有沒有遇到過這種情況?您對(duì)如何顯示這些錯(cuò)誤有什么建議嗎?任何幫助將不勝感激!
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 組件的內(nèi)部錯(cuò)誤處理只能捕獲異常,不能捕獲 PHP 錯(cuò)誤.
The internal error handling of the framework's MVC components can only trap Exceptions, not PHP errors.
為了在開發(fā)過程中協(xié)助調(diào)試,可以使用標(biāo)準(zhǔn):
To assist in debugging during development, you can use the standard:
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 'on');
此外,如果您使用的是 1.8 附帶的新自動(dòng)加載器,請(qǐng)使用:
Also, if you're using the new Autoloader included with 1.8, use:
Zend_Loader_Autoloader::getInstance()->suppressNotFoundWarnings(false);
允許發(fā)出失敗的包含/要求語句.
To allow failed include/require statements to be issued.
這篇關(guān)于使用 Zend 框架時(shí)顯示 php 錯(cuò)誤的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!