1、Driver [Think] not supported.
报错场景:
<?php
namespace app\admin\controller;
use app\BaseController;
use think\facade\View;
class Index extends BaseController
{
public function index()
{
return View::fetch();
}
}
解决:
composer require topthink/think-view
2、BaseController无法跳转问题,可通过以下方法解决
<?php
namespace app\admin\controller;
use app\BaseController;
use think\exception\HttpResponseException;
class Base extends BaseController
{
public function initialize()
{
parent::initialize();
if ('条件成立') {
return $this->redirect(url('index/index'), 302);
}
}
/** 重定向
* @param array ...$args
*/
public function redirect(...$args)
{
throw new HttpResponseException(redirect(...$args));
}
}
加我微信公众号:,定期更新文章,一起学习哦~
网友评论