|
版本 2.2.0
使用form_validation 后 报错 Message: Use of undefined constant required - assumed 'required'
源码如下:
PHP复制代码 [/size ][/font ][/color ]
public function add ($page='add'){
if (! file_exists(APPPATH .'/views/type/'.$page.'.php')) {
show_404 ();
}
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('typeName','分类名称',required );
if ($this->form_validation->run() === FALSE) {
$data['title'] = '添加分类';
$this->load->view('templates/header',$data);
$this->load->view('type/add.php');
$this->load->view('templates/footer');
}else{
$this->type_model->insert_type();
$data['title'] = '分类名称列表';
$this->load->view('templates/header',$data);
$this->load->view('type/list');
$this->load->view('templates/footer');
}
}
[color =#000] 复制代码
|
|