返回模型验证器-控......登陆

模型验证器-控制器

@smash2019-04-06 13:45:39177

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 ();   }}

最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送