win10 安装thinkphp6

因为一直是用PHPStudy的本地环境,所以composer 基于PHPStudy来安装的。

一、 安装PHPStudy

点击下载,找到自己心仪的安装位置,一路下一步即可。

二、安装composer

  1. 通过PHPStudy安装composer

    微信截图_20210206212531.png
  1. 设置环境变量

    1. 以win10为例,按下win键,输入env,回车

      环境变量.png
    2. 设置环境变量

      设置PHP路径.png
  2. 将composer设置国内镜像

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
  1. composer更新到最新版本
composer self-update
  1. 使用composer下载thinkphp6
composer create-project topthink/think
  1. 测试thinkphp6
cd tp6
php think run 
    
ThinkPHP Development server is started On 
You can exit with `CTRL-C`
// 点击[http://127.0.0.1:8000](http://127.0.0.1:8000) 即可访问tp久违的页面了
  1. 开启thinkphp6的多应用模式

    1. 首先删除app目录下所有其他的文件

    2. 安装多应用模式扩展:

      composer require topthink/think-multi-app
      
    3. 创建三大应用index(前端),home(后台),common(公共应用)

      php think build index
      Successed
      PS D:\phpstudy\WWW\think> php think build home
      Successed
      PS D:\phpstudy\WWW\think> php think build common
      Successed
      
      注意:如果没有安装think-multi-app, 使用php think build xx会报错:Command "build" is not defined.
      
  2. 到此,OK,可以开始学习或者干活了。

你可能感兴趣的:(win10 安装thinkphp6)