修改基类

This commit is contained in:
cxdbz committed 2019-12-04 20:12:43 +08:00
1 parent 6fc9c6861d
commit bbaa12e65f
2 files changed
+11 -10

No files matched your search

+3
View File
@@ -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
}
}
+8 -10
View File
@@ -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');
}