ThinkPHP6下 Driver [Think] not su

2023-07-02  本文已影响0人  ArslanRobot

controller中Index.php文件

<?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后就可以解决

上一篇 下一篇

猜你喜欢

热点阅读