我正在关注源文件可以在这里找到:https ://github.com/JeffreyWay/Simple-CI-Authentication
现在,当我尝试登录时,它不断循环说我有错误,在教程视频中他返回正常并且没有显示错误。
I get The Email Address field is required.The Password field is required.
即使我为这两个有效的字段输入了输入,这也是我的代码:
应用程序/控制器/admin.php
<?php if(! defined('BASEPATH')) exit('No direct script access allowed');
class Admin extends CI_Controller
{
public function index()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('email_address', 'Email Address', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[4]');
if ($this->form_validation->run() !== FALSE)
{
$this->load->model('Admin_model');
$this->Admin_model->verify_user('test@admin.com', 'test');
// then validation passed. get from the db.
}
$this->load->view('login_view');
}
}
应用程序/视图/login_view.php
<h1>Login</h1>
<?php echo form_open('admin'); ?>
<p>
<?php
echo form_label('Email Address: ', 'email_address');
echo form_input('Email Address', '', 'id="email_address"');
?>
</p>
<p>
<?php
echo form_label('Password: ', 'password');
echo form_password('Password', '', 'id="password"');
?>
</p>
<?php echo form_submit('submit', 'Login'); ?>
<?php echo form_close(); ?>
<div class="errors"><?php echo validation_errors(); ?></div>
有任何想法吗?