[ThinkPHP6 series learning-1] Download and deploy ThinkPHP6

Table of contents

1. Download ThinkPHP6

2. Directory structure

3. Deploy and configure virtual domain name


1. Download ThinkPHP6

Open cmd in the specified directory (www directory) and use composer to download thinkphp6. The thinkphp6 after the command is the downloaded directory name and can be modified at will.

composer create-project topthink/think thinkphp6

2. Directory structure

After downloading, check the directory structure. The directory structure of tp6 is different from that of tp5. The default is single application (only one module). If you need multiple applications, you need to enable the multi-application mode, which will be discussed in a later article.

The main directories used are app, view, config, and pulic. For detailed introduction, please refer to the official website instructions https://www.kancloud.cn/manual/thinkphp6_0/1037483

app/controller/ is the controller directory, corresponding to the application/module name/controller/ of tp5

app/model/ is the model directory, corresponding to the application/module name/model/ of tp5

view/ is the view directory, which stores front-end pages and corresponds to the application/module name/view/ of tp5.

config/ is a configuration file. The configuration information of tp5 is filled in a file config.php. tp6 separates multiple files and puts them in the config directory.

public/ public file, public/index.php is the project entry file

.example.env is an environment convenience sample file. Before using it, you need to create a new file named ".evn." as an environment variable file.

www  WEB部署目录(或者子目录)
├─app           应用目录
│  ├─controller      控制器目录
│  ├─model           模型目录
│  ├─ ...            更多类库目录
│  │
│  ├─common.php         公共函数文件
│  └─event.php          事件定义文件
│
├─config                配置目录
│  ├─app.php            应用配置
│  ├─cache.php          缓存配置
│  ├─console.php        控制台配置
│  ├─cookie.php         Cookie配置
│  ├─database.php       数据库配置
│  ├─filesystem.php     文件磁盘配置
│  ├─lang.php           多语言配置
│  ├─log.php            日志配置
│  ├─middleware.php     中间件配置
│  ├─route.php          URL和路由配置
│  ├─session.php        Session配置
│  ├─trace.php          Trace配置
│  └─view.php           视图配置
│
├─view            视图目录
├─route                 路由定义目录
│  ├─route.php          路由定义文件
│  └─ ...   
│
├─public                WEB目录(对外访问目录)
│  ├─index.php          入口文件
│  ├─router.php         快速测试文件
│  └─.htaccess          用于apache的重写
│
├─extend                扩展类库目录
├─runtime               应用的运行时目录(可写,可定制)
├─vendor                Composer类库目录
├─.example.env          环境变量示例文件
├─composer.json         composer 定义文件
├─LICENSE.txt           授权说明文件
├─README.md             README 文件
├─think                 命令行入口文件

3. Deploy and configure virtual domain name

After the installation is successful, configure a domain name for the project. After the configuration is completed, you can directly enter the domain name to access. This is a single application mode. Basically, there is no need to modify the configuration. When configuring the path, the entry file is still /public/index.php

The above is to configure a single application, the operation is relatively simple, but projects generally have multiple modules (multi-application mode), and the multi-application mode is somewhat different from tp5.

Next article [ThinkPHP6 Series Learning-2] Multi-application mode configuration

Guess you like

Origin blog.csdn.net/qq_25285531/article/details/130747978