自动验证

浏览:497 发布日期:2013/04/15 分类:求助交流 关键字: 自动验证
FormModel代码:
protected $_validate = array(
array('addtitle','require','标题不能为空!'),
array('FCKeditor1','require','内容不能为空!'),
);

FormAction代码:
public function addnew(){
if (!empty($_POST['sub'])) {
$new = D('Form');
if(!$new->create()) {
session('show','display');
$this->error($new->getError(),'__ACTION__');

}else{
$this>success('Ok');
//$this->display('link:news');
}
//$data
}else{
$this->display('link:news');
}
}

即使标题跟内容都填了,也不会输出ok,而是没有任何信息的错误跳转,如图:

刚刚开始学习thinkphp,望高手指点!!
最佳答案
评论( 相关
后面还有条评论,点击查看>>