Home > Article > PHP Framework > Sharing and learning: TP6 project construction short record
下面thinkphp框架教程栏目将给大家分享一个thinkphp6 项目搭建小记录,希望对需要的朋友有所帮助!
thinkphp6 项目搭建记录
第一步:创建项目
composer create-project topthink/think "项目名称"
第二步:配置数据库链接
修改 .env 文件
[DATABASE]TYPE = mysqlHOSTNAME = 127.0.0.1DATABASE = 数据库USERNAME = 用户PASSWORD = 密码HOSTPORT = 3306CHARSET = utf8DEBUG = true
第三步:配置伪静态
Apache
<IfModule mod_rewrite.c>Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]</IfModule>SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
nginx
location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; }}
推荐:《最新的10个thinkphp视频教程》
The above is the detailed content of Sharing and learning: TP6 project construction short record. For more information, please follow other related articles on the PHP Chinese website!