From 4c87db02637a0e6b94a6805dcb58923e2628d922 Mon Sep 17 00:00:00 2001 From: cxdbz Date: Sun, 1 Dec 2019 21:27:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AC=A2=E8=BF=8E=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/Base.php | 28 ---------------------------- app/common/controller/BaseError.php | 19 ++++++++++++------- app/index/controller/Index.php | 6 ++++-- app/index/route/index.php | 2 +- 4 files changed, 17 insertions(+), 38 deletions(-) delete mode 100644 app/common/controller/Base.php diff --git a/app/common/controller/Base.php b/app/common/controller/Base.php deleted file mode 100644 index 95fc8b24..00000000 --- a/app/common/controller/Base.php +++ /dev/null @@ -1,28 +0,0 @@ -[ - 'except'=>[ - 'exit', - ], - ], - ]; - - public function _empty() - { - $this->error('不好意思,您访问的页面不存在~'); - } - -} diff --git a/app/common/controller/BaseError.php b/app/common/controller/BaseError.php index cea4231b..29c291ff 100644 --- a/app/common/controller/BaseError.php +++ b/app/common/controller/BaseError.php @@ -12,15 +12,20 @@ class BaseError extends BaseController * * @return \think\Response */ - public function index() - { - // 跳转页面 - $this->error('不好意思,您访问的页面不存在~'); - } + // public function index() + // { + // // 跳转页面 + // $this->error('不好意思,您访问的页面不存在~'); + // } - public function _empty() + // public function _empty() + // { + // $this->error('不好意思,您访问的页面不存在~'); + // } + + public function __call($method, $args) { - $this->error('不好意思,您访问的页面不存在~'); + return 'error request!'; } } diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 3777e793..d913785e 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -6,6 +6,8 @@ namespace app\index\controller; use app\BaseController; // 引用与此控制器同名的数据模型 use app\system\model\SystemBase as sysbasemod; +// 引用视图功能类 +use think\facade\View; @@ -141,11 +143,11 @@ class Index extends BaseController // 模版赋值 - $this->assign('list',$list); + View::assign('list',$list); // 渲染输出 - return $this->fetch(); + return View::fetch('welcome'); } diff --git a/app/index/route/index.php b/app/index/route/index.php index 0a9b0f58..36242dfd 100644 --- a/app/index/route/index.php +++ b/app/index/route/index.php @@ -12,4 +12,4 @@ use think\facade\Route; Route::rule('/','login/index'); //主页 -// Route::get('welcome','index/welcome'); //欢迎页 +Route::get('welcome','index/welcome'); //欢迎页