我是codeigniter的新手。提交表單時,我得到的404錯誤頁面未找到。實際上,如果沒有輸入用戶名和密碼,它應該起作用。這是代碼。雖然提交表單我得到的頁面找不到codeigniter
在控制器的login.php
public function verifyuser()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('username','username','required');
$this->form_validation->set_rules('password','password','required');
if($this->form_validation->run() == FALSE){
$this->load->view('login/login');
}else{
$this->load->model('login/validate');
}
}
* 登錄/ login.php中 *
<?php echo form_open('verifyuser'); ?>
<!-- start login-inner -->
<div id="login-inner">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<th>Username</th>
<td><input type="text" name="username" class="login-inp" /></td>
</tr>
<tr>
<th>Password</th>
<td><input type="password" name="password" value="************" onfocus="this.value=''" class="login-inp" /></td>
</tr>
<tr>
<th></th>
<td valign="top"><input type="checkbox" class="checkbox-size" id="login-check" /><label for="login-check">Remember me</label></td>
</tr>
<tr>
<th></th>
<td><input type="submit" value="submit" class="submit-login" /></td>
</tr>
</table>
</div>
答案是* login/login.php * <?php echo form_open('login/verifyuser'); ?> – user1736182