首頁  >  文章  >  php框架  >  yii2支援php7嗎

yii2支援php7嗎

(*-*)浩
(*-*)浩原創
2019-11-05 10:14:373526瀏覽

yii2支援php7嗎

先說Yii框架PHP運作環境的狀況。

Yii 2.0.12 版本使用 \yii\base\Object 類,Object 以類別名稱 PHP7.2 錯誤。   (建議學習:yii教學

PHP7.2 的 Yii2 最小可用版本為 2.0.13。

提供若干升級的方法。

專案使用Composer管理 bower 和 npm 前端資源。

安裝最新版 composer-asset-plugin

composer global require "fxp/composer-asset-plugin"

指定類別庫更新

composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquery.inputmask

#Composer記錄如下

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+1755to 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 cacheWriting lock fileGenerating autoload files

專案配置不透過Composer管理bower和npm的資源

如果你的Yii2做介面應用程式、微框架,不需要JS,CSS,或自行管理前端資源,在安裝更新的時候可以移除對bower和npm的資源的依賴。

修改 composer.json

 "require" : {
      "yiisoft/yii2": "2.0.16"
  },
  "replace": {
      "bower-asset/inputmask": ">=3.2.0"
  }

#按需升級

composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquery.inputmask

如果有報錯,一般都是前端資源依賴問題,移除即可。

以上是yii2支援php7嗎的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn