fecmall 二次开发新建的controller访问报错:Failed to instantiate component or class 【已解决】

技术分享 · haikou · 于 4年前 发布 · 3151 次阅读

新建controller访问报错:

Invalid Configuration – yii\base\InvalidConfigException
Failed to instantiate component or class "fecbvc\app\appadmin\modules\Catalog\controllers\ProductpdfController".
↵
Caused by: ReflectionException
Class fecbvc\app\appadmin\modules\Catalog\controllers\ProductpdfController does not exist
in /www/web/demo/fecbvc/vendor/yiisoft/yii2/di/Container.php at line 447

1. in /www/web/demo/fecbvc/vendor/yiisoft/yii2/di/Container.phpat line 449
440441442443444445446447448449450451452453454455456457458    {
        if (isset($this->_reflections[$class])) {
            return [$this->_reflections[$class], $this->_dependencies[$class]];
        }
 
        $dependencies = [];
        try {
            $reflection = new ReflectionClass($class);
        } catch (\ReflectionException $e) {
            throw new InvalidConfigException('Failed to instantiate component or class "' . $class . '".', 0, $e);
        }
 
        $constructor = $reflection->getConstructor();
        if ($constructor !== null) {
            foreach ($constructor->getParameters() as $param) {
                if (version_compare(PHP_VERSION, '5.6.0', '>=') && $param->isVariadic()) {
                    break;
                } elseif ($param->isDefaultValueAvailable()) {
                    $dependencies[] = $param->getDefaultValue();

后台发现是大小写的文件

fecbvc\app\appadmin\modules\ catalog \controllers

应该写成:

fecbvc\app\appadmin\modules\ Catalog \controllers

也就是catalog没有大写导致的

共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics