人家的官方文档上步骤都有了,按照步骤走就行
安装composer 不作赘述
附一个文档链接:
安装 · ThinkPHP5.1完全开发手册 · 看云
主要说一个自己踩过的坑吧
composer create-project topthink/think=5.1.* tp5
在输入这个命令以后提示
[Composer\Downloader\TransportException]
The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: HTTP request failed!
或者
[Composer\Downloader\TransportException]
The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream: HTTP request failed!
只需要将镜像换成阿里的即可
(文档上的说法)
#更改composer镜像源为国内地址
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
The "https://repo.packagist.org/p/laravel/laravel.json" file could not be downloaded: failed to open_one312的博客-CSDN博客
第二个坑:
更新完镜像以后,又报
Warning from https://mirrors.aliyun.com/composer: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
[Composer\Downloader\TransportException]
The "https://mirrors.aliyun.com/composer/p/provider-2017%248b8b2c1627e2216d9b910bf3d8218b05804048e6ee6c09746f82e0b39532964a.json" file could not be downloaded (HTTP/1.1 404 Not Found)
此时只需要将composer升级即可
composer 报错 The “https://mirrors.aliyun.com/composer/p....json“ file could not be downloaded (HTTP/1_玻璃人小高的博客-CSDN博客
执行完成以后,项目文件夹里会有一个tp5的文件
此时只需要
测试运行即可