diff --git a/app/BaseController.php b/app/BaseController.php index 76031676..4d8eccad 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -8,6 +8,7 @@ use think\exception\ValidateException; use think\Validate; use app\middleware\UserLogin; use app\middleware\Auth; +use think\View; /** @@ -28,6 +29,7 @@ abstract class BaseController */ protected $app; + /** * 是否批量验证 * @var bool @@ -101,4 +103,5 @@ abstract class BaseController } + } diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 26a14b04..f8b4d069 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -5,8 +5,6 @@ namespace app\index\controller; use app\BaseController; // 引用与此控制器同名的数据模型 use app\system\model\SystemBase as sysbasemod; -// 引用视图类 -use think\facade\View; class Index extends BaseController @@ -15,10 +13,11 @@ class Index extends BaseController // 初始化 protected function initialize() { - + } + // 主页 public function index() { @@ -80,13 +79,12 @@ class Index extends BaseController ]) ->order(['paixu']) ->select()->toArray(); - // return view('list', $list); - + $view = app('view'); // 模版赋值 - View::assign('list',$list); + $view->assign('list',$list); // 渲染输出 - return View::fetch(); + return $view->fetch(); } @@ -137,13 +135,13 @@ class Index extends BaseController - + $view = app('view'); // 模版赋值 - View::assign('list',$list); + $view->assign('list',$list); // 渲染输出 - return View::fetch('welcome'); + return $view->fetch('welcome'); }