我的表格:
<?php
echo validation_errors();
$clientLoginFormAttr = array('id'=>'clientLogin');
echo form_open('clientLogin',$clientLoginFormAttr);
## generate field attributes
$userNameInput=array(
'type' =>'text',
'id' => 'clientLogin',
'name' => 'clientUsername',
'maxlength' => '10',
'size' => '20'
);
$passwordInput=array(
'type'=>'password',
'id'=>'clientLogin',
'name'=>'clientPass',
'maxlength'=>'10',
'size'=>'20'
);
$submitBtn=array(
'type'=>'submit',
'id'=>'submit',
'value'=>'',
'name'=>'sendLogon'
);
## generate actual <input> fields
echo '<label>Username:</label>';
echo form_input($userNameInput);
echo '<label>Password:</label>';
echo form_input($passwordInput);
echo form_submit($submitBtn);
?>
我想使用位于 (controllers/pages/hndl/clientLogin.php) 中的clientLogin控制器
clientLogin控制器包含:
<?php
class Clientlogin extends CI_Controller{
function index(){
$this->load->helper(array('url','form'));
$this->load->library('form_validation');
$loginValidation = array(
array(
'field'=>'clientUsername',
'rules'=>'required|min_length[1]|max_length[10]'
),
array(
'field'=>'clientPass',
'rules'=>'required|min_length[1]|max_length[10]'
)
);
$this->form_validation->set_rules($loginValidation);
}
}
?>
当我访问设置为默认加载视图的主页(称为 homepage.php)并按下提交按钮时,它给了我 ERROR-404 OBJECT NOT FOUND。它进入路径:
http://localhost/Applications/XAMPP/htdocs/website/homepage.php/clientLogin
我在这里做错了什么?我只是想使用 clientLogin 控制器来控制从 homepage.php 视图提交的表单。谢谢