Home > PHP Framework > ThinkPHP > Sharing and learning: TP6 project construction short record

Sharing and learning: TP6 project construction short record

藏色散人
Release: 2021-11-01 16:08:37
forward
2114 people have browsed it

下面thinkphp框架教程栏目将给大家分享一个thinkphp6 项目搭建小记录,希望对需要的朋友有所帮助!

Sharing and learning: TP6 project construction short record

thinkphp6 项目搭建记录

第一步:创建项目

composer create-project topthink/think "项目名称"
Copy after login

第二步:配置数据库链接

修改 .env 文件

[DATABASE]TYPE = mysqlHOSTNAME = 127.0.0.1DATABASE = 数据库USERNAME = 用户PASSWORD = 密码HOSTPORT = 3306CHARSET = utf8DEBUG = true
Copy after login

第三步:配置伪静态

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
Copy after login

nginx

location / {
 if (!-e $request_filename) {
         rewrite  ^(.*)$  /index.php?s=/$1  last;
  }}
Copy after login

推荐:《最新的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!

Related labels:
tp6
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template