当我在控制器文件夹中编写以下代码时,命名文件LoginController.php
,
<?php
class LoginController extends CI_Controller
{
public function index()
{
$this->load->view('login');
}
public function check()
{
$this->form_validation->set_rules('username','Username','required|valid_email');
$this->form_validation->set_rules('password','Password','required');
}
if ($this->form_validation->run() == FALSE)
{
$this->load->view('login');
}
else{}
}
?>
发出以下解析警告:
-Parse error: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) in C:\xampp\htdocs\CodeIgniter\application\controllers\LoginController.php on line 14