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

浏览:3317 发布日期:2014/06/18 分类:功能实现
自动验证 为什么会出现 “非法数据对象!”
<?php

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的:
<?php
namespace Home\Model;
use Think\Model;
class titleModel extends Model {

protected $_validate =
array(

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

);
}

view:
<form action="{:U('Index/index')}" method="post" />
title:<input type="text" name="title" /><br/>
<input type="submit" name="submit" value="提交" />
</form>
</div>
评论( 相关
后面还有条评论,点击查看>>