私人领地

thinkphp新增

$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

}

posted @ 2015-11-08 13:23  狂奔的蜗牛Snails  阅读(148)  评论(0编辑  收藏  举报