控制器未调用操作

时间:2012-01-11 09:43:57

标签: zend-form zend-framework

我在应用程序/控制器中有一个控制器名称UserController

基础文件夹是zend-login,有3个子文件夹1 = application 2 = library 3 = web_root 问题在这里!!我什么时候点击http://localhost/zend_login/web_root/user/loginhttp://localhost/zend_login/web_root/user/register 我收到此错误错误404对象未找到!这两个文件都在文件夹中

<?php
require_once 'Zend/Controller/Action.php';
class UserController extends Zend_Controller_Action{
public function indexAction(){
$this->view->assign('name', 'xainee');
$this->view->assign('title', 'Hello');
}
public function loginAction(){
$request = $this->getRequest();  
$this->view->assign('action', $request->getParam());  
$this->view->assign('title', 'Login Form');
$this->view->assign('username', 'User Name');   
$this->view->assign('password', 'Password');
}

public function registerAction(){
$request = $this->getRequest();
$this->view->assign('action',"process");
$this->view->assign('title','Member Registration');
$this->view->assign('label_fname','First Name');
$this->view->assign('label_lname','Last Name'); 
$this->view->assign('label_uname','User Name'); 
$this->view->assign('label_pass','Password');
$this->view->assign('label_submit','Register');     
$this->view->assign('description','Please enter this form completely:');
}
}
 ?>


action for this is here views/scripts/user/register.phtml and 
views/scripts/user/login.phtml 
this is register.phtml

<?php include "header.phtml"; ?>
<h1><?=$this->escape($this->title);?></h1>
<div id="description">
<?=$this->escape($this->description);?>
 </div>
<form name="register" method="post" action="<?=$this->escape($this->action)?>">
<table>
<tr>
 <td><?=$this->escape($this->label_fname)?></td>
 <td><input type="text" name="first_name"></td>
</tr>
<tr>
<td><?=$this->escape($this->label_lname)?></td>
<td><input type="text" name="last_name"></td>
</tr>   
<tr>
<td><?=$this->escape($this->label_uname)?></td>
<td><input type="text" name="user_name"></td>
</tr>   
<tr>
<td><?=$this->escape($this->label_pass)?></td>
<td><input type="password" name="password"></td>
</tr>   
</table>
<input type="submit" name="submit" value="<?=$this->escape($this->label_submit);?>">
</form>
<?php include "footer.phtml"; ?>

1 个答案:

答案 0 :(得分:1)

推荐.htaccess是 RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L]