项目从product调整成dev,然后pc访问出现yii\base\InvalidValueException config key: 'beforeContent', can not find in Yii::$service->page->widget->widgetConfig, you must config it before use it.

bug问题 · an94er · 于 5年前 发布 · 2409 次阅读

操作描述

首先说明论坛搜索过之前有相似的例子http://www.fecshop.com/topic/862, 但是我并未升级,是刚安装的,安装好之后报"File is not Found.",论坛搜索找到原因,给所有文件加上755权限之后就报标题的错误了,具体信息跟截图如下:

错误日志

yii\base\InvalidValueException config key: 'beforeContent', can not find in Yii::$service->page->widget->widgetConfig, you must config it before use it.

  1. in /www/web/fecshop/vendor/fancyecommerce/fecshop/services/page/Widget.php at line 62 53545556575859606162636465666768697071 {

     $config = '';
     if (is_array($configKey)) {
         $config = $configKey;
         $configKey = '';
     } else {
         if (isset($this->widgetConfig[$configKey])) {
             $config = $this->widgetConfig[$configKey];
         } else {
             throw new InvalidValueException(" config key: '$configKey', can not find in  ".'Yii::$service->page->widget->widgetConfig'.', you must config it before use it.');
         }
     }
    
     return $this->renderContent($configKey, $config, $parentThis);
    

    } /**

    • @property $configKey | string ,使用配置中的widget,该参数对应相应的数组key
    • @property $config,就是上面actionRender()方法中的参数,格式一样。
    • @property $parentThis | array or '' , 调用层传递的参数数组,可以在view中调用。

最后说明

我是部署在公网上并且有域名的,是http://appfront.copy163.com/ ,谁知道麻烦告知一下怎么解决,按照惯例,我一般都会解决完就在qq群发红包啦,谢谢啦

共收到 12 条回复
Fecmall#15年前 0 个赞

配置文件:appfront/config/fecshop_local_services/Page.php

也就是:https://github.com/fecshop/yii2_fecshop_app_advanced/blob/master/appfront/config/fecshop_local_services/Page.php

183行处有配置:

					'beforeContent' => [
                        'view'  => 'widgets/beforeContent.php',
                    ],

看看你的文件是否存在, 如果不存在,建议自己加上,当然配置中的view文件也要存在,不然会报错。 view文件是:https://github.com/fecshop/yii2_fecshop/blob/master/app/appfront/theme/base/front/widgets/beforeContent.php

我猜测,你可能是没有升级,但是,你为了修复某些bug,手动进行了更改,新代码有一部分加了一些新功能,但是你的配置没有添加这些新配置进而导致的

!!建议升级(如果修改了vendor下面的文件就不能升级了,强烈建议按照标准的方式重写。)

Fecmall#35年前 0 个赞

这个部分的添加,是为了serviceLog日志的打印:http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-service-log.html

an94er#45年前 0 个赞

@fecshop 是不是参考升级教程,改了版本号,然后在docker容器里面进行升级的呢,我的是在php容器里面进行composer update,结果: Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead. Writing lock file Generating autoload files 貌似升级失败了

an94er#55年前 0 个赞

而且, https://github.com/fancyecommerce/yii2_fecshop/releases 这个查看版本号链接失效了,如果可以的话建议修复下

Fecmall#65年前 0 个赞

最新版本查看:https://github.com/fecshop/yii2_fecshop/releases

如果是最新版本则不需要升级。

升级前,执行下更新: composer selfupdate

an94er#75年前 0 个赞

用这个composer selfupdate先也不行啊,无法升级。。。

root@08c0591a2aa2:/www/web/fecshop# composer selfupdate You are already using composer version 1.6.5 (stable channel). root@08c0591a2aa2:/www/web/fecshop# composer update Do not run Composer as root/super user! See https://getcomposer.org/root for details The "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asset.installer-paths" option Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead. Generating autoload files

Fecmall#85年前 0 个赞

@an94er #7楼 升级问题,去开新帖,一个问题一个帖子

Fecmall#95年前 0 个赞

升级文档进行了更新:http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-about-update.html

2.2.2升级的操作
有时候,可能有一些升级的配置导致一些基本的配置进行更改,因此,如果您想升级到最新版本, 建议您直接打开文件:https://github.com/fecshop/yii2_fecshop_app_advanced/blob/master/composer.json ,将里面的内容覆盖您fecshop根目录的 composer.json文件即可,因为除了一些版本号的更改,可能还有一些其他的配置的更改。

然后在根目录下面执行composer update即可完成升级。
Fecmall#105年前 0 个赞

注意 composer安装反馈的信息,仔细看回馈内容,回馈的东西不一定是报错信息。

帖子内容用markdown格式整理好:http://www.fecshop.com/markdown

an94er#115年前 1 个赞

问题已经解决,解决办法如下: 直接在php的容器里面 删除旧版本然后升级成Fecshop 1.4.3.2,当前操作时最新版,已经可以正常访问了 不知为啥,按照 http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-about-update.html 这里真更新不了,原因有空再研究了

至于markdown,我已经整理好,不对请指正 最后感谢群主,不说了,先去群里发红包:smile:

Terry#125年前 0 个赞

最新版本:https://github.com/fecshop/yii2_fecshop_app_advanced/blob/master/appfront/config/fecshop_local_services/Page.php

中是有 beforeContent的配置的,直接安装最新版本不会有这个问题,如果升级,需要按照升级文档的说明。

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics