Home PHP Framework ThinkPHP ThinkPHP6.0 turns on multi-application mode

ThinkPHP6.0 turns on multi-application mode

Nov 15, 2020 pm 07:55 PM

ThinkPHP has developed to the 6..0. Optimization improvements and more standardization. Due to the introduction of some new features, the ThinkPHP6.0 operating environment requires PHP7.1 and does not support seamless upgrades to 5.1 (the official upgrade guide is provided for project upgrade reference). From version 6 onwards, the official website will no longer provide downloads. Composer is required to install or update, and Git download and installation is not allowed.

1. Install the thinkphp6.0 framework:

composer create-project topthink/think thinkphpV6.0.5
Copy after login

Generate the directory. The default directory structure after installation is a single application mode. :

ThinkPHP6.0 turns on multi-application mode

#2. When the framework needs to use multiple application modules, it cannot directly create a module like tp5. Composer needs to install the corresponding think The -multi-app extension can only be used.

Install multi-application module extension: think-multi-app:

composer require topthink/think-multi-app
Copy after login

Special note: When installing, it must be installed in the root directory of the project, otherwise it will be used after installation. No, then there is a problem with the order application (app\controller\index does not exist).

ThinkPHP6.0 turns on multi-application mode

3. Delete the controller directory under the app directory, and then execute the following instructions to generate the index module:

Instruction code:

php think build index //其中index是要生成的模块
//如果要生成admin模块,则将index改成admin。
Copy after login

ThinkPHP6.0 turns on multi-application mode

After execution, check the project directory in phpstorm and you can generate the index module.

ThinkPHP6.0 turns on multi-application mode

Note:

The three files BaseController.php, Request.php and ExceptionHandle.php are the basic files provided by the system by default. You can move them at will. , but be careful to adjust the namespace of the class synchronously. If you do not need to use the Request.php and ExceptionHandle.php files, or if you want to adjust the class name, remember to adjust the container object binding in the provider.php file simultaneously.

4. Download and install think-view template engine driver extension:

composer  require topthink/think-view
Copy after login

ThinkPHP6.0 turns on multi-application mode

5. Multi-mode access is enough .

ThinkPHP6.0 turns on multi-application mode

Enter in the browser: http://localhost:8010/thinkPHPV6.0.5/public/ (note the port number, mine is 8010), observe Effect:

ThinkPHP6.0 turns on multi-application mode

If it appears: No input file specified.

The solution is:

Open the .htaccess file under public,

Put:RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

Change to:RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

The above is the detailed content of ThinkPHP6.0 turns on multi-application mode. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How can I use ThinkPHP to build command-line applications? How can I use ThinkPHP to build command-line applications? Mar 12, 2025 pm 05:48 PM

This article demonstrates building command-line applications (CLIs) using ThinkPHP's CLI capabilities. It emphasizes best practices like modular design, dependency injection, and robust error handling, while highlighting common pitfalls such as insu

What Are the Key Considerations for Using ThinkPHP in a Serverless Architecture? What Are the Key Considerations for Using ThinkPHP in a Serverless Architecture? Mar 18, 2025 pm 04:54 PM

The article discusses key considerations for using ThinkPHP in serverless architectures, focusing on performance optimization, stateless design, and security. It highlights benefits like cost efficiency and scalability, but also addresses challenges

What Are the Advanced Features of ThinkPHP's Dependency Injection Container? What Are the Advanced Features of ThinkPHP's Dependency Injection Container? Mar 18, 2025 pm 04:50 PM

ThinkPHP's IoC container offers advanced features like lazy loading, contextual binding, and method injection for efficient dependency management in PHP apps.Character count: 159

How can I prevent SQL injection vulnerabilities in ThinkPHP? How can I prevent SQL injection vulnerabilities in ThinkPHP? Mar 14, 2025 pm 01:18 PM

The article discusses preventing SQL injection vulnerabilities in ThinkPHP through parameterized queries, avoiding raw SQL, using ORM, regular updates, and proper error handling. It also covers best practices for securing database queries and validat

How to Build a Distributed Task Queue System with ThinkPHP and RabbitMQ? How to Build a Distributed Task Queue System with ThinkPHP and RabbitMQ? Mar 18, 2025 pm 04:45 PM

The article outlines building a distributed task queue system using ThinkPHP and RabbitMQ, focusing on installation, configuration, task management, and scalability. Key issues include ensuring high availability, avoiding common pitfalls like imprope

What Are the Key Features of ThinkPHP's Built-in Testing Framework? What Are the Key Features of ThinkPHP's Built-in Testing Framework? Mar 18, 2025 pm 05:01 PM

The article discusses ThinkPHP's built-in testing framework, highlighting its key features like unit and integration testing, and how it enhances application reliability through early bug detection and improved code quality.

What Are the Key Differences Between ThinkPHP 5 and ThinkPHP 6, and When to Use Each? What Are the Key Differences Between ThinkPHP 5 and ThinkPHP 6, and When to Use Each? Mar 14, 2025 pm 01:30 PM

The article discusses key differences between ThinkPHP 5 and 6, focusing on architecture, features, performance, and suitability for legacy upgrades. ThinkPHP 5 is recommended for traditional projects and legacy systems, while ThinkPHP 6 suits new pr

How to Implement Service Discovery and Load Balancing in ThinkPHP Microservices? How to Implement Service Discovery and Load Balancing in ThinkPHP Microservices? Mar 18, 2025 pm 04:51 PM

The article discusses implementing service discovery and load balancing in ThinkPHP microservices, focusing on setup, best practices, integration methods, and recommended tools.[159 characters]

See all articles