namespace app\admin\controller;use think\Controller;class Category extends Controller{ public function index () { //判断post请求 if ( request ()->isPost () ) { //实例化Category模型 //模型返回的数据['code'=>1,'msg'=>'操作成功'] //input ('post.')接受post提交数据 $model = ( new \app\common\model\Category() )->store (input ('post.')); if ( $model[ 'code' ] ) { return $this->success ( $model[ 'msg' ] , 'index' ); } else { return $this->error ( $model[ 'msg' ] ); } } //渲染模板 return view (); }}