33558 www.PHP.cn/wenda/159638.html
1. ThinkPHP大事记
2017年4月27日,thinkphp 5.1-beta.1发表
2017年12月31日,ThinkPHP5.1.0发布,标志着快速进入反复期
2019年3月3日,ThinkPHP5.1更新为版本35(5.1.35 )
2019年3月22日,ThinkPHP5.2的dev开发版本也发布了
现在,好消息和坏消息,你先听哪个?
告诉你吧,坏消息:江湖上再也没有ThinkPHP5.2了!
好消息: ThinkPHP5.2已正式更名为ThinkPHP6.0啦
2. 核心功能与主要特征
全面支持PHP7的上位功能
全面支持几乎所有的PSR开发规范
实现了多APP应用支持
全面部署事件系统替代行为
新的APP应用服务体系结构
视图和模板引擎分离,项目配置更加灵活
使IDE助手、编辑器的智能提示更准确
原始版本中的某些函数和类方法已得到统一和简化
3. 环境要求与源码下载
3.1 环境要求:PHP 7.1
2.2 源码下载
如您所知,从ThinkPHP5.1开始,官网不再提供框架源下载
因此,ThinkPHP6.0 (以下简称TP6 )当然也无法从官方网站下载
从哪里下载? 两条路
Composer 和 Git
参考
下载和安装Composer教程: http://www.PHP.cn/code/30828.html
Git教程: http://www.php.cn/tool/git/
用最常见、官方推荐的Composer方法下载框架源
4. Composer 下载与安装
4.1 Mac / Linux
1
2
3
4
5
//1 .下载com poser.phar :
curl-ss https://get composer.org/installer|PHP
将//2.composer命令移动到落后的豌豆目录中,以便全局使用
mvcomposer.phar/usr/local/落后的豌豆/composer
注:MacOS 10.14、user/local/落后的豌豆文件夹不存在,必须手动创建
1
2
3
4
5
//3 .设置中国全量镜像,加快访问速度
composer config-grepo.packagistcomposer https://packag ist.PHP composer.com
//如果上述错误有问题,请使用此镜像地址
composer config-grepo.packagistcomposer https://packag ist.laravel-China.org
4.2 Windows
打开3https://www.PHPcomposer.com/:下载setup.exe安装程序即可
4.3 测试
在终端上输入:composer命令后,将显示命令消息,表示安装成功
4.4 更新版本
1
composerselfupdate//终端运行此命令以将composer更新为最新版本
5. TP6 框架源码下载
)1) Composer官方网站:https://www.phpcomposer.com/
打开安装软件包列表,可以看到https://packagist.org/
输入搜索关键字: topthink,以下是与ThinkPHP框架相关的组件包
打开时,将显示ThinkPHP6.0的版本标签和安装命令
以下
是详细的框架源码下载过程:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 打开终端,执行指令:
composer create-project topthink/think tp6 6.0.*-dev
/**
* 指令中各个参数的解释:
* `create-project`: 是composer中的项目创建命令
* `topthink/think`: ThinkPHP的组件包
* `tp6`: 是当前的项目目录(如果没有创建, 该命令会自动创建的)
* `6.0.*-dev`: 要下载的版本标签
*/
// 以下是源码的下载中的提示信息
Installing topthink/think (6.0.x-dev 9ea8d9fd39a1aac440fd355cf8b4361130267bce)
- Installing topthink/think (6.0.x-dev 9ea8d9f):
Cloning 9ea8d9fd39
- Installing topthink/think (6.0.x-dev 9ea8d9f): Downloading (100%)
Created project in tp
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 9 installs, 0 updates, 0 removals
- Installing topthink/think-installer (v2.0.0): Downloading (100%)
- Installing opis/closure (3.1.6): Downloading (100%)
- Installing psr/simple-cache (1.0.1): Downloading (100%)
- Installing psr/log (1.1.0): Downloading (100%)
- Installing psr/container (1.0.0): Downloading (100%)
- Installing psr/cache (1.0.1): Downloading (100%)
- Installing topthink/framework (6.0.x-dev e9af162): Downloading (100%)
- Installing topthink/think-template (v2.0.1): Downloading (100%)
- Installing topthink/think-view (v1.0.5): Downloading (100%)
Writing lock file
Generating autoload files
> @php think service:discover
Succeed!
> @php think vendor:publish
Succeed!
下载完成后, 打开项目目录,例如: tp6, 可以看到如下的目录结构:
6.框架测试
这里使用框架内置的 think 命令测试
该命令会启动一个本地的临时Web服务器,功能与 php -S localhost:8000 是一样的
详细步骤如下:
1
2
3
4
5
6
7
8
9
10
11
// 1. 打开终端工具, 切换到当前的Web目录下面
// 2. 进入tp6项目目录
cd tp6
// 3. 创建本地服务器, 启动框架
php think run
// 提示用户在本机的8000商品开启了一个Web服务
ThinkPHP Development server is started On <http://127.0.0.1:8000/>
You can exit with `CTRL-C`
根据提示打开浏览器, 在地址栏输入:
127.0.0.1:8000 或者 localhost:8000 ,显示如下界面
恭喜, ThinkPHP6 框架已经安装成功~~
想现在就体验TinkPHP6吗? 下载源码狠戳这里: http://www.php.cn/xiazai/code/5685
相关参考推荐:
1. ThinkPHP6.0版本正式发布,全面拥抱组件化开发趋势
2. ThinkPHP6.0极速入门(视频教程)
3. ThinkPHP6.0完全开发手册(官方版)