thinkphp setup.php,安装 Thinkphp5.1.x

Thinkphp5.1版本开始,官网不再提供下载版本,需要使用 `Composer` 或者 `git` 方式安装和更新。

下面就详细讲解一下在 `Windows` 操作系统中用 `Composer` 安装的流程:

>[danger] ThinkPHP5.1的环境要求如下:

~~~

PHP >= 5.6.0

PDO PHP Extension

MBstring PHP Extension

~~~

### 安装前准备

>[success] 在 Windows 中,你需要下载并运行 [Composer-Setup.exe](https://getcomposer.org/Composer-Setup.exe)。

> 如果遇到任何问题或者想更深入地学习 Composer,请参考 [Composer 中文](https://www.kancloud.cn/thinkphp/composer)。

[安装 Composer-Setup.exe 软件教程 请点击这里](https://www.kancloud.cn/yjf-kj/v2018/743788)

>[success] 安装 Composer 完成后,再继续下面的操作。

> 打开CMD命令行窗口 ( 按住win键+R键 然后输入 cmd 再按回车键即可 )

> 比如将Thinkphp5.1安装到 F 盘下的Thinkphp,在命令行窗口输入

> 需要先切换到F盘,看图操作吧.~\_~

![](https://box.kancloud.cn/3bdc00bbae3c3cb9ce94022ee7535790_527x191.png)

现在你的CMD命令行窗口界面应该是这样的:如上图所示

~~~

F:\Thinkphp>

~~~

第一步:选择镜像

~~~

composer config -g repo.packagist composer https://packagist.laravel-china.org

~~~

>[danger] 运行后可能会出现:

> No composer.json in current directory, do you want to use the one at F:\\Thinkphp? \[Y,n\]?

> 只需要输入 Y 即可.**(不出现不用管,继续下面的操作)**

第二步:开始安装 (如果你是第一次安装的话)

~~~

composer create-project topthink/think tp5

~~~

上面的 `tp5` 目录名你可以任意更改,执行完毕后,会在当前Thinkphp目录下的tp5子目录安装最新版本的ThinkPHP,这个目录就是我们后面会经常提到的应用根目录。

>[success] 当你看到这个图所示证明安装成功了. 打开你的电脑F盘看看, 是不是很激动咧...

![](https://box.kancloud.cn/0a93193538f33ff87122d9279d6f5b94_609x383.png)

### 安装完成 ~\_~!

>[info] 温馨提示:

> 如果你之前已经安装过,那么切换到你的应用根目录下面,然后执行下面的命令进行更新:

~~~

composer update topthink/framework

~~~

*****

*****

你可能需要安装的扩展,先进入到 应用根目录 (就是上面说到的tp5目录)

现在你的CMD命令行窗口界面最后一行应该是这样的:

~~~

F:\Thinkphp>tp5>

~~~

>[success] 确认目录正确后,继续在命令行窗口输入以下代码安装扩展

验证码

~~~

composer require topthink/think-captcha

~~~

图片处理

~~~

composer require topthink/think-image

~~~

常用助手

~~~

composer require topthink/think-helper

~~~

#### 安装扩展的步骤 如图所示

![](https://box.kancloud.cn/f8802ec6318cf6629eb3ec3fbd37acc6_617x516.png)

下面的备用,需要的话,自己安装咯...

针对ThinkPHP5的扩展包 需要使用Composer安装

| 扩展名 | 地址 |

| --- | --- |

| 应用单元测试 | [https://github.com/top-think/think-testing.git](https://github.com/top-think/think-testing.git) |

| 验证码 | [https://github.com/top-think/think-captcha.git](https://github.com/top-think/think-captcha.git) |

| 队列 | [https://github.com/top-think/think-queue.git](https://github.com/top-think/think-queue.git) |

| MongoDb支持 | [https://github.com/top-think/think-mongo.git](https://github.com/top-think/think-mongo.git) |

| angular模板引擎 | [https://github.com/top-think/think-angular.git](https://github.com/top-think/think-angular.git) |

| 助手库 | [https://github.com/top-think/think-helper.git](https://github.com/top-think/think-helper.git) |

| 数据库迁移工具 | [https://github.com/top-think/think-migration.git](https://github.com/top-think/think-migration.git) |

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值