zend frameworks配置出錯,只能訪問預設控制器解決方案

來源:互聯網
上載者:User
zend frameworks配置出錯,只能訪問預設控制器
如題

1、http://localhost:8080/ZendFramework_qyweb/
2、http://localhost:8080/ZendFramework_qyweb/index
3、http://localhost:8080/ZendFramework_qyweb/index/index/

1可以訪問,2、3不能訪問,提示404錯誤


APACHE配置也按教程上的改過


httpd.conf


Options FollowSymLinks
#AllowOverride None
AllowOverride All
Order deny,allow
Deny from all
Satisfy all



LoadModule rewrite_module modules/mod_rewrite.so


項目目錄結構:
|-application
|----|-config
|----|-controllers
|----|----|----|-IndexController.php
|----|-models
|----|-views
|----|----|-filters
|----|----|-helpers
|----|----|-scripts
|----|----|----|-index.phtml




IndexController.php
class IndexController extends Zend_Controller_Action
{

public function init()
{
/* Initialize action controller here */
$this->registry=Zend_Registry::getInstance();
$this->view=$this->registry['view'];
$this->view->baseUrl=$this->_request->getBaseUrl();
}

public function indexAction()
{
// action body
$message=new Message();//
//
$this->view->messages=$message->fetchAll()->toArray();

echo $this->view->render('index.phtml');//
}
}

?>


備忘:
|----|----|-scripts
|----|----|-----|-index
|----|----|-----|----|-index.phtml

不支援scripts子目錄

------解決方案--------------------
探討
解決了,

原因:httpd.conf檔案中有多個AllowOverride None


全改過後,
1、http://localhost:8080/ZendFramework_qyweb/
2、http://localhost:8080/ZendFramework_qyweb/index
3、http://localhost:8080/ZendFramework_qyweb/i……
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.