abstrait:namespace app\admin\controller;use think\Controller;class Category extends Controller{ public function index () { //判斷post請(qǐng)求 if ( request ()-&
namespace app\admin\controller;use think\Controller;class Category extends Controller{ public function index () { //判斷post請(qǐng)求 if ( request ()->isPost () ) { //實(shí)例化Category模型 //模型返回的數(shù)據(jù)['code'=>1,'msg'=>'操作成功'] //input ('post.')接受post提交數(shù)據(jù) $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 (); }}
Professeur correcteur:天蓬老師Temps de correction:2019-04-08 09:53:32
Résumé du professeur:你的作業(yè)提交也太不走心了, 請(qǐng)問(wèn)這樣的代碼, 你讓我怎么看?
namespace app\admin\controller;use think\Controller;class Category extends Controller{ public function index () { //判斷post請(qǐng)求 if ( request ()->isPost ()