ZF 1.12.3을 사용합니다.
색인에서 내가 가지고
define('APPLICATION_ENV', 'development');
오류:
Notice: Trying to get property of non-object in application/controllers/ErrorController.php on line 28
이 줄에는
$errors = $this->_getParam('error_handler');
나는 추가 할 해결책을 좋아한다
Zend_Controller_Front::getInstance()->throwExceptions(false);
부 스트랩-하지만 내 실수를 진정 시키지는 않아
application.ini :
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
autoloaderNamespaces[] = "mea\"
includePaths.mea = APPLICATION_PATH "/../library/Vendor/mea"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.view[] =
appnamespace = "Application"
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
Controlerr 오류 :
<?php
class ErrorController extends Zend_Controller_Action
{
public function init()
{
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Application',
'basePath' => APPLICATION_PATH
));
ZendX_JQuery::enableView( $this->view);
}
public function errorAction()
{
$errors = $this->_getParam('error_handler');
if(!$errors){
}
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
// 404 error -- controller or action not found
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error';
break;
}
$this->view->exception = $errors->exception;
$this->view->request = $errors->request;
}
}
그래서 내가 생각하는 문제는 예외가 없지만 오류 컨트롤러를 직접 실행하려고합니다 (이유를 모르겠습니다),
이 시도,
if($errors!=null){
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
// 404 error -- controller or action not found
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error';
break;
}
$this->view->exception = $errors->exception;
$this->view->request = $errors->request;
}
도움이 되길 바랍니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다