为什么有的地方双重验证,有的却不要
在控制器post中先表单验证
$this->form_validation->set_rules('title', '标题', 'required|trim|htmlspecialchars');
'title' =>$this->input->post('title',TRUE),
入库时再验证
'title' =>empty($content['title']) ? NULL : $content['title']
而控制器user中
先表单验证
$this->form_validation->set_rules('uname', '用户名', 'required|trim|alpha_numeric|callback__name_check|strip_tags');
入库时未验证
$this->users_mdl->add_user(
array(
'name' => $this->input->post('uname',TRUE),
这里是否也需要empty啊
楼主你把问题说详细一点!!! justdoit 发表于 2012-3-15 16:16 static/image/common/back.gif
楼主你把问题说详细一点!!!
'title' =>empty($content['title']) ? NULL : $content['title']
这里有empty判断,下面的却不用?
'name' => $this->input->post('uname',TRUE),
可以自己加上去的嘛:lol 应该是加上判断的,你的这段代码是在手册上看到的还是----??? justdoit 发表于 2012-3-15 17:24 static/image/common/back.gif
应该是加上判断的,你的这段代码是在手册上看到的还是----???
ST源码上面的。
我只是不知道 在用表单类验证过后,还是否有必要 在更新数据库的时候,再 进行验证。
页:
[1]