前言
ThinkPHP是一个免费开源的,快速、简单的面向对象的轻量级PHP开发框架,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。
thinkphp5.0文档地址
https://www.kancloud.cn/manual/thinkphp5/118003
Composer安装
在 Windows 中,你需要下载并运行 Composer-Setup.exe
注意:若安装composer时Warning: readfile(): SSL operation failed with code 1. OpenSSL Error messages:
1.先在官网下载composer.phar
下载地址为:https://getcomposer.org/download/
2.将composer.phar粘贴到php.exe的同级文件夹下(比如:D:xamppphp)
3.新建 composer.bat 内容是
@ECHO OFF php "%~dp0composer.phar" %*
4.将php放到环境变量中,具体操作是右键点击“计算机”,选“属性”->“高级系统设置”->“环境变量”,可在用户变量中新建“path”,值为php.exe的路径(即以上例子中的“D:xamppphp”。)
5.安装已经完成,再打开cmd,输入“composer -v”,出现
则已经安装完成。
6.使用阿里云的composer镜像
composer config -g repo.packagist composer https://packagist.phpcomposer.com
7.在命令行下面,切换到你的web根目录下面并执行下面的命令:
composer create-project topthink/think=5.0.* tp5 --prefer-dist
thinkphp5.0路径去掉public
方法:先配置vhost指向public
如何配置vhost:
apache配置localhost虚拟主机步骤:
1.打开apache目录下httpd文件
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2.打开httpd-vhost文件,配置虚拟主机
#<VirtualHost *:80> # ServerName localhost # ServerAlias localhost # DocumentRoot "${INSTALL_DIR}/www" # <Directory "${INSTALL_DIR}/www"> # Options +Indexes +Includes +FollowSymLinks +MultiViews # AllowOverride All # Require local # </Directory> #</VirtualHost> <VirtualHost *:80> ServerName www.tp5.com ServerAlias www.tp5.com DocumentRoot "F:www p5public" <Directory "F:www p5public"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Order Allow,Deny Allow from all </Directory> </VirtualHost>
3.修改hosts文件
添加一行:127.0.0.1 www.tp5.com