YII Install 安装

Yii是一款开源PHP框架,提供两个主要版本:2.0和1.1。Yii 2.0基于PHP 5.4.0重写,支持免费开发开源及专有Web应用。本文介绍Yii 2.0的安装方式,包括通过Composer安装及从存档文件安装,并提供了升级指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Download

Yii is an open source project released under the terms of the BSD License. This means that you can use Yii for free to develop either open-source or proprietary Web applications.

Currently there are two major versions of Yii: 2.0 and 1.1.

Yii 2.0

The latest version of Yii 2 is 2.0.10, released on October 20, 2016. Yii 2.0 is a complete rewrite of Yii on top of PHP 5.4.0. It is aimed to be a state-of-the-art of the new generation of PHP framework. Yii 2.0 is not compatible with 1.1.

There are two ways to install Yii 2: using Composer, or downloading an application template. We highly recommend you to use the former.

Install via Composer

This is the preferred way of installing Yii 2.0. If you do not have Composer yet, you may install it by following the instructions here.

After installing Composer, run the following command to install the Composer Asset Plugin:

php composer.phar global require "fxp/composer-asset-plugin:~1.2.0"

Now choose one of the application templates to start installing Yii 2.0. An application template is a package that contains a skeleton Web application written in Yii.

  • To install the basic application template, run the command below:
    php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.10
  • To install the advanced application template, run the command below:
    php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.10
  • Update including require-dev

   composer update

 

Note that you may be prompted to enter your GitHub username and password during the installation process. This is normal. Just enter them and continue.

Install from an Archive File

Download one of the following archive files, and then extract it to a Web-accessible folder:

Upgrade from Older Versions

If you are upgrading from Yii 2.0.0 with composer, simply run the following commands in your project's root directory:

First, make sure you have the latest version of the Composer Asset Plugin:

php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"

Then upgrade Yii by running:

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

If you installed Yii using an archive file, you should download the new release file, extract it and replace the older version with the new one.

Upgrading from Yii 1.1 is not trivial. Please refer to the guide about upgrading from Yii 1.1.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值