當發生Zend_Controller_Dispatcher_Exception: Invalid controller specified (error)錯誤時

 Zend_Controller_Dispatcher_Exception: Invalid controller specified (error) in ***ZendControllerDispatcherStandard.php on line 248 php

這個錯誤時,通過分析zend framework的源碼發現問題是出如今了根目錄上.apache

我是經過地址http://localhost/Zend_Framework/public/index/訪問的,根目錄應該是public,可是zend framework將localhost做爲了根目錄,將Zend_Framework當成了controller名,而將public當成了action.解決辦法就是經過虛擬主機將public目錄設爲地址的根目錄.設置方法見apache設置方法.ide

方法二:修改默認根目錄:
$frontController = Zend_Controller_Front::getInstance();
$frontController->setBaseUrl(‘根目錄’);
注意根目錄就是完整地址,沒有主機名.例若是地址是http://localhost//zend_framework/public則根目錄設
‘/zend_framework/public’spa

相關文章
相關標籤/搜索