温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

yii2支不支持php7

发布时间:2020-12-31 14:55:06 来源:亿速云 阅读:200 作者:小新 栏目:编程语言

这篇文章将为大家详细讲解有关yii2支不支持php7,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

先说一下Yii框架PHP运行环境的情况。

Yii 2.0.12 版本使用 \yii\base\Object 类,Object 作为类名 PHP7.2 报错。

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”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI