我有一个可以工作的前端控制器。我编写了一个名为 AuthController.php 的登录控制器。它内部配置了适当的代码。我的问题是当我转到 /auth 时,我得到一个 404。这似乎是某种路由问题。
我的身份验证控制器称为 AuthController.php,它的顶部如下所示:
class AuthController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$form = new Application_Form_Login();
$request = $this->getRequest();
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
if ($this->_process($form->getValues())) {
// We're authenticated! Redirect to the home page
$this->_helper->redirector('index', 'index');
}
}
}
$this->view->form = $form;
}
当然,下面还有一些受保护的函数可以处理其他事情。在 Zend 中,当您创建一个新控制器时,它的存在(如在 CodeIgniter 中)是否意味着它应该可用?还是我必须将它添加到某处的路由表中?
编辑:这是我的 Apache Vhost 配置:
<VirtualHost *:80>
ServerName new.mydomain.com
DocumentRoot /www/htdocs/zend/public
<Directory /www/htdocs/zend/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>