问题描述
今天更新composer依赖项(使用composer更新命令)后,我的Yii2应用程序崩溃 - 它引发未知方法 - yii \base\UnknownMethodException:调用未知方法:yii \web\UrlManager :: addrules()
检查 vendor / yiisoft / yii2 / web / UrlManager.php 文件后, addRule。
和整个类 UrlManager 与存储库中的类不同。
我的composer.json:
minimum-stability:dev,
require:{
php: = 5.4.0,
yiisoft / yii2:*,
yiisoft / yii2-bootstrap:*,
yiisoft / yii2-swiftmailer: ,
yiisoft / yii2-gii:2.0.0-beta,
claudejanz / yii2-mygii:*,
kartik-v / yii2-grid :dev-master,
kartik-v / yii2-builder:dev-master,
2 amigos/yii2-switch-widget:*,
yiisoft / yii2-jui:*,
DsXack / yii2-underscore:*,
2 amigos/yii2-editable-widget:*,
warrence / yii2-kartikgii:*
},
require-dev:{
yiisoft / yii2-codeception:*,
yiisoft / yii2-debug:*
},
说明了为什么会发生这种情况:
前面提到的正确解决方案是安装:
php composer.phar global requirefxp / composer-asset-plugin:1.0。* @ dev
After todays update of composer dependencies (with composer update command) my Yii2 application became broken - It throws Unknown Method – yii\base\UnknownMethodException: Calling unknown method: yii\web\UrlManager::addRules()
After inspecting vendor/yiisoft/yii2/web/UrlManager.php file I found that there is no method addRule.And the whole entire class UrlManager is different from the class in the repository.
My composer.json:
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"yiisoft/yii2-gii": "2.0.0-beta",
"claudejanz/yii2-mygii": "*",
"kartik-v/yii2-grid": "dev-master",
"kartik-v/yii2-builder": "dev-master",
"2amigos/yii2-switch-widget": "*",
"yiisoft/yii2-jui": "*",
"DsXack/yii2-underscore": "*",
"2amigos/yii2-editable-widget": "*",
"warrence/yii2-kartikgii": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*"
},
Here is an explaination of why this happened:
The correct solution as already mentioned is to install the composer-asset-plugin:
php composer.phar global require "fxp/composer-asset-plugin:1.0.*@dev"
这篇关于Yii2错误:yii\base\UnknownMethodException:调用未知方法:yii\web\UrlManager :: addRules()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!