abstract:namespace app\admin\controller;use think\Controller;class Category extends Controller{ public function index () { //判断post请求 if ( request ()-&
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 (); }}
Correcting teacher:天蓬老师Correction time:2019-04-08 09:53:32
Teacher's summary:你的作业提交也太不走心了, 请问这样的代码, 你让我怎么看?
namespace app\admin\controller;use think\Controller;class Category extends Controller{ public function index () { //判断post请求 if ( request ()->isPost ()