$m = M('content'); //与 $m = new Model('content')效果一样
$date = array(
'username' => I('username','','htmlspecialchars');
'content' => I('content','','htmlspecialchars');
'time' => time()
)
$result = $m->$date($data)->add();
if($result){
$this->success('发布成功','index'); // $this->success('发布成功',U('Index/index'));
}else{
$this->error('发布失败',''); // 返回,相当于back
}