Thinkphp5欄目編輯處理

控制器層:

public function edit(){

        $cate = newCateModel();

       if(request()->isPost()){

            $save =$cate->save(input('post.'),['id'=>input('id')]);

            if($save !==false){

               $this->success('修改欄目成功!',url('lst'));

            }else{

               $this->error('修改欄目失敗!');

            }

            return;

        }

        $cates =$cate->find(input('id'));

        $cateres = $cate->catetree();

        $this->assign(

            array(

               'cateres'=>$cateres,

               'cates'=>$cates,

                ));

        return view();

    }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章