ThinkPHP6下 Driver [Think] not supported错误解决方法

controller中Index.php文件


declare (strict_types = 1);

namespace app\index\controller;
use think\facade\View;

class Index
{
    public function index()
    {
        // 模板输出
        return View::fetch('index');
    }
}

浏览器访问http://localhost:8511/index访问页面出现以下错误
#0 [0]InvalidArgumentException in Manager.php line 104
Driver [Think] not supported错误ThinkPHP6.0

{
    if ($this->namespace || false !== strpos($type, '\\')) {
        $class = false !== strpos($type, '\\') ? $type : $this->namespace . Str::studly($type);

        if (class_exists($class)) {
            return $class;
        }
    }

    throw new InvalidArgumentException("Driver [$type] not supported.");
}

/**
 * 获取驱动参数
 * @param $name
 * @return array
 */
protected function resolveParams($name): array
{

需要在项目根目录下执行 composer require topthink/think-view后就可以解决

你可能感兴趣的:(软件开发,php)