2012-07-26 88 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')); 

然後你可以訪問它。

謝謝。