Install and run


ThinkPHP6 installation

  • Starting from version 6.0, it must be installed and updated through Composer, so you cannot download and install through Git.

  • PHP >= 7.1.0

1. InstallationComposer

In Windows, Download the Composer software

Step 1: Double-click the downloaded composer to run the program

Step 2: Select the drive letter to be installed

Step 3: Select the php version. If you are using an integrated package environment, go to the integrated package and look for php

Step 4: All Next steps

2. SetupComposer Download source

First set the download source of Composer , which is also the mirror address

Enter

composer config -g repo.packagist in the command line window or console composer https://packagist.phpcomposer.com

Foreign websites are slow, the official website recommends using domestic mirrors (Alibaba Cloud)

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer

3. Composer download and install ThinkPHP6

First switch to the root directory of the php environment

cd d:/phpstudy/www

is executing the download Thinkphp6 command. The last tp is to create a new tp directory, which can be changed

composer create-project topthink/think tp

Update Thinkphp6 core

composer update topthink/framework

Note: The directories where the installation and update commands are located are different. The update must be executed under your application root directory

4. Directory structure after successful installation

  • The main change in the directory structure of version 6.0 is that the core framework is incorporated into the vendor directory, and then the original application directory becomes the app directory.

  • The directory structure after installation is a single application mode

  • In a mac or linux environment, please note that the runtime directory permissions need to be set to 777

www WEB deployment directory (or subdirectory)

├─app Application directory

│ ├─controller Controller directory

│ ├─model           Model directory

│ ├─...                                                                          ’ s           through ’’s     out through out''s' ’ through out's'' ’’‐'  ‐‐‐‐‐‐‐‐ ​ ​ │ │ │ │ │ │ │

##│ └─event.php Event definition file

├─config Configuration directory

│ ├─app.php Application configuration

│ ├─cache.php │ Cache configuration

│ ├─console.php Console configuration

│ ├─cookie.php Cookie configuration

│ ├─database.php │ Database configuration

│ ├─filesystem.php File disk configuration

│ ├─lang.php │ Multi-language configuration

│ ├─ log.php         Log configuration

│ ├─middleware.php  Middleware configuration

│ ├─route.php         URL and routing configuration

│ ├─session.php    Session configuration

│ ├─trace.php Trace configuration

│ └─view.php View configuration

├─view View directory

├─route                Route definition directory

│       ├─route.php                                                                                     ’ ’s ’ s ’ s     through ’ way through way's       through through through through‐‐ over through‐to‐‐‐through‐ route to go to the route definition directory

│                public WEB directory (external access directory)

│ ├─index.php Entry file

│ ├─router.php Quick test file

│ └─.htaccess Used for Rewriting of apache

├─extend Extended class library directory

├─runtime Application runtime directory (writable, customizable)

├─vendor           Composer class library directory

├─.example.env          Environment variable example file

├─composer.json              -       composer definition file

├─LICENSE.txt          Description file

├─README.md README file

├─think Command line entry file

5. Run Thinkphp6

Note: We We only talk about the PHP environment integration package in Windows system, how to access it

Step one: Open phpstudy integration software-》Site domain name management

Step two: Website domain name: www.xxx.com

Step 3: Website directory: tp/public

Step 4: In the C:\Windows\System32\drivers\etc directory, open the hosts file

Step 5: Enter 127.0.0.1 www.xxx.com

in the last line. Step 6: Enter the domain name (www.xxx.com) directly on the browser

6. ThinkPHP6 core directory

6485bb1f9a851373e2a7902c7c92a1e.png