我正在使用 Zend Server 在 Zend MVC 中创建一个 hello world 项目。一些路由是错误的。我通过 zend_tool zf.sh 创建项目创建项目,因此它自己创建所有目录,我修改为 indexController 以尝试以下操作,所有其他文件都提醒相同..
<?php
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
$this->_helper->viewRenderer->setNoRender();
}
public function indexAction()
{
// action body
$this->getResponse()->appendBody('hello from about Action');
}
public function aboutAction()
{
$this->getResponse()->appendBody('hello from about Action');
// action body
}
}
当我输入“http://localhost/index.php”时,它会显示来自 indexAction() 的正确信息;
当我输入“http://localhost/index”时,它显示当我输入“http://localhost/index.php/about”时
找不到页面
,它显示“消息:指定的控制器无效(关于)”请求参数:
数组(
'controller' => 'about',
'action' => 'index',
'module' => 'default', )
我希望控制器是索引和动作是关于..我该如何解决它......
我在我的 apache 配置中有这个。我想我可能有这个配置错误,但我不知道在哪里。
<VirtualHost *:80>
#DocumentRoot "/usr/local/zend/apache2/htdocs"
DocumentRoot /home/testuser/projects/helloworldproject/public
<Directory "/home/testuser/projects/helloworldproject/public/">
SetEnv APPLICATION_ENV "development"
Order allow,deny
Allow from All
</Directory>
谢谢你的时间。