2012-07-26 94 views
0

我是Zend Framework的新手,我正尝试使用它建立一个小网站。因此,为了构建CMS,我在作者Forrest Lyman的Apress网站上找到了一个源代码。我也从本地市场拿到这本书。未找到异常'Zend_Acl_Exception',显示消息'Resource not found'

我想单独拥有管理模块,所以我创建了管理模块,但我遇到了问题,因为我无法访问控制器而不是IndexController。当我尝试访问管理模块我收到此错误另一个控制器:

Fatal error: Uncaught exception 'Zend_Acl_Exception' with message 'Resource 'category' not found' in C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Acl.php:365 Stack trace: #0 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Acl.php(846): Zend_Acl->get('category') #1 C:\Server\Zend\Apache2\htdocs\cms\library\CMS\Controller\Plugin\Acl.php(52): Zend_Acl->isAllowed('administrator', 'category', 'index') #2 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Plugin\Broker.php(309): CMS_Controller_Plugin_Acl->preDispatch(Object(Zend_Controller_Request_Http)) #3 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Front.php(941): Zend_Controller_Plugin_Broker->preDispatch(Object(Zend_Controller_Request_Http)) #4 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch() #5 C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #6 in C:\Server\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Plugin\Broker.php on line 312

回答

1

我找到了解决办法..

使控制器之后,我不得不在Acl.php文件,该文件是添加资源位于(library/CMS/Controller/Plugin /)。 只需在资源区添加该项

$acl->add(new Zend_Acl_Resource('category')); 

然后你可以访问它。

谢谢。