问题1:如果post提交的话字段能填充进来(但是前台的字段必须写成数据库字段才行)
问题2:如果不是POST一个字段的值都填充不进来
下面的是代码
Controll
public function addFunc(){
// if (!IS_POST) {
// $this->error('页面不存在');
// }
$news = D('News');
if($news->create()){//填充前台的字段
echo $news->id." == ".$news->uuid." = ".$news->news_title;
dump($data);
die;
}
}Model// 字段映射
protected $_map = array(
'uuid' =>'uuid' //
);
// 自动验证
Protected $_validate = array(
array('id','require','帐号不能为空'),
array('uuid','require','用户名不能为空'),
array('news_title','require','新闻标题不能为空'),
);
// 自动完成
Protected $_auto = array(
array('uuid','md5',3,'function'),
array('news_createtime','time',3,'function')
); 最佳答案