Home > php教程 > php手册 > 自动验证 为什么会出现 “非法数据对象!”

自动验证 为什么会出现 “非法数据对象!”

WBOY
Release: 2016-06-07 11:41:36
Original
1119 people have browsed it

自动验证 为什么会出现 “非法数据对象!”

namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$User = D("title");
// 实例化User对象
if (!$User->create()){

// 创建数据对象
// 如果创建失败 表示验证没有通过 输出错误提示信息
exit($User->getError());
}else{

// 验证通过 写入新增数据
$User->add();
}

//$this->display();
}
}




MODEL的:
namespace Home\Model;
use Think\Model;
class TitleModel extends Model {

protected $_validate =
array(

array('title','require','验证码必须!'),

);
}

view:


TITLE:



AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template