请问一下这一个类方法为什么没有作用呢?

浏览:392 发布日期:2016/10/29 分类:求助交流
请问一下这一个类方法为什么没有作用呢?
M('shoplist')->where("id='$goodsid'")->setField("iscomment","2");
这一行代码对吗?是什么意思呢?谢谢public function add() {
        if ( !is_login() ) {
              $this->redirect("User/login" );
        } 
        if (IS_POST) {
             $uid=is_login();
             $comment=D("comment");
             $comment->create();
             $comment->uid = $uid; // 修改数据对象的status属性
             $comment->create_time = NOW_TIME; // 增加time属性
             $goodsid=session('goodsid'); 
             $comment->goodid = session('goodsid'); // 商品id
             $comment->status = 1; // 增加time属性
             $id=$comment->add();
             if($id>0){ 
                $this->redirect('Comment/lists');
                M('shoplist')->where("id='$goodsid'")->setField("iscomment","2");
              }
         }else {
             $id=I('get.goodsid');
             /* 标识正确性检测 */
             if(!($id && is_numeric($id))){
               $this->error('文档ID错误!');
             }
             session('goodsid',null);
             session('goodsid',$id);
             $this->display();
        }  
    }
最佳答案
评论() 相关
后面还有条评论,点击查看>>