????: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 () ) { //實(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 (); }}
?? ???:天蓬老師?? ??:2019-04-08 09:53:32
???? ??:你的作業(yè)提交也太不走心了, 請問這樣的代碼, 你讓我怎么看?
namespace app\admin\controller;use think\Controller;class Category extends Controller{ public function index () { //判斷post請求 if ( request ()->isPost ()