인증을 확인하기 위해 컨트롤러 플러그인을 작성하려고합니다. 플러그인 클래스를 생성하고 Application 디렉토리에 Application.php를 넣고 Bootstrap.php에 등록했습니다. 하지만 오류가 있습니다 : 치명적인 오류 : '인증'클래스를 찾을 수 없습니다. 젠드 프레임 워크는 플러그인을 어디에서 찾을 수 있습니까?Zend Framework에서 컨트롤러 플러그인을 찾을 수없는 이유
//Application/Authentication.php
class Authentication extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
return;
}
self::setDispatched(false);
// handle unauthorized request...
}
}
//bootstrap
protected function _initAutoloader()
{
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'basePath' => APPLICATION_PATH,
'namespace' => ''));
$autoLoader = Zend_Loader_Autoloader::getInstance();
$autoLoader->registerNamespace('Common_');
return $moduleLoader;
}
protected function _initPlugins()
{
$controller = Zend_Controller_Front::getInstance();
$controller->registerPlugin(new Authentication());
$controller->dispatch();
}
감사합니다.
가 나는 또한 사용 \t 보호 기능 _initAutoloader() \t { \t \t $ moduleLoader = 새로운 Zend_Application_Module_Autoloader (배열 ( \t \t 'basePath'=> APPLICATION_PATH, \t \t '네임 스페이스를'=> '')); \t \t \t \t $ autoLoader = Zend_Loader_Autoloader :: getInstance(); \t \t $ autoLoader-> registerNamespace ('Common_'); \t \t \t \t return $ moduleLoader; \t \t \t \t} – Oleg
더 많은 정밀도를 제공하는 의견을 추가하는 대신 질문을 편집 할 수 있습니다. 질문을 수정하여 첫 번째 코드 블록을 수정할 수도 있습니다 ... –
정보 주셔서 감사합니다. – Oleg