ThinkPHP5的环境要求如下:
PHP >= 5.4.0
PDO PHP Extension
CURL PHP Extension
Mb_String PHP Extension
由于本机已安装过PHPStudy和git,就不一一赘述了。
直接开始ThinkPHP5的安装过程吧~
一、Git方式安装
1.打开https://github.com/top-think/
2.找到think,点击
3.复制
4.在WWW目录中右键打开Git Bash Here
,输入git clone [--dapth=1] https://github.com/top-think/think.git think_git
–dapth=1 指clone 最新的一次代码
5.切换到think_git目录,并安装核心
git clone https://github.com/top-think/framework.git thinkphp
6.打开think_git中的public目录(执行文件在该目录下),出现下图则表示安装成功
其实一开始出现了报错:
Parse error: syntax error, unexpected ‘.’, expecting ‘&’ or variable (T_VARIABLE)
检查了一下扩展,都没问题。然后试着PHP版本从5.5.38切换成5.6.27,就可以了
emmm不是说好的>=5.4就行吗
所以出错时可以试着改改你的PHP版本和扩展,说不定就ok了。
二、Composer方式安装
1.安装composer
https://getcomposer.org/download/
安装到你使用的PHP版本目录下
其余的一直点next就好
用命令composer -v
检查是否安装成功(如下图)
2.然后通过下面的命令来设置镜像
命令:composer config -g repo.packagist composer https://packagist.phpcomposer.com
回车即可
镜像参考地址:https://pkg.phpcomposer.com/
3.下载tp5框架
命令:composer create-project topthink/think=5.0.* tp5 --prefer-dist
tp5可自行更改
4.访问public目录,出现下图即安装成功