<?php
namespace Home\Model;
use Think\Model;
class NewsModel extends Model{
// 定义自动验证
protected $_validate = array(
array(),
);
// 定义自动完成
protected $_auto = array(
array('post_time','time',3,'function'),
);
}IndexController.class.php public function insert()
{
// echo "save_member";
// dump(I("post."));
$News = D('News');
if ($News->create()) {
// $News->post_time = NOW_TIME;
$result = $News->add();
if ($result) {
$this->success('数据添加成功!');
// echo $News->getLastSql();
} else {
$this->error('数据添加错误!');
}
} else {
$this->error($News->getError());
}
}数据库的post_time 没有数据 最佳答案