先說一下Yii框架PHP運行環境的狀況。前端
Yii2.0.12版本使用\yii\base\Object類,Object做爲類名PHP7.2報錯。jquery
PHP7.2的Yii2最小可用版本爲2.0.13。git
提供若干升級的方法。github
bower
和npm
前端資源。安裝最新版composer-asset-plugin
npm
composer global require "fxp/composer-asset-plugin"
指定類庫更新json
composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquery.inputmask
Composer記錄以下api
Loading composer repositories with package information Updating dependencies (including require-dev) Reading bower.json of bower-asset/yii2-pjax (2.0.7.1)GitHub API limit (60 calls/hr) is exhausted, could not fetch https://api.github.com/repos/yiisoft/jquery-pjax/commits/aef7b953107264f00234902a3880eb50dafc48be. Create a GitHub OAuth token to go over the API rate limit. You can also wait until 2019-02-15 18:54:52 for the rate limit to reset. Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+bw-hz-dev-v14+2019-02-15+1755 to retrieve a token. It will be stored in "/data/home/hanguangchao/.config/composer/auth.json" for future use by Composer. Token (hidden): Package operations: 1 install, 2 updates, 1 removal - Removing bower-asset/jquery.inputmask (3.3.7) - Updating yiisoft/yii2-composer (2.0.5 => 2.0.7): Loading from cache - Installing bower-asset/inputmask (3.3.11): Downloading (100%) - Updating yiisoft/yii2 (2.0.12 => 2.0.16): Loading from cache Writing lock file Generating autoload files
bower
和npm
的資源若是你的Yii2作接口應用、微框架,不須要JS,CSS,或自行管理前端資源,在安裝更新的時候能夠移除對bower
和npm
的資源的依賴。yii2
修改composer.json
composer
"require" : { "yiisoft/yii2": "2.0.16" }, "replace": { "bower-asset/inputmask": ">=3.2.0" }
按需升級框架
composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquery.inputmask
若是有報錯,通常都是前端資源依賴問題,移除便可。