thinkPHP is a popular PHP development framework that is widely used in the development of web applications. When using thinkPHP to develop projects, you often need to access the root directory of the framework, so it is very important to understand the root directory structure and file contents of the thinkPHP framework.
thinkPHP’s root directory is the core of the entire framework and contains many important files and directories. The following will introduce the root directory structure and file functions of thinkPHP, and how to use the root directory for project development.
- Root directory structure
The root directory of thinkPHP framework mainly contains the following files and folders:
├── application // 應(yīng)用目錄 │ ├── common // 公共模塊 │ ├── index // 默認(rèn)模塊 │ └── …… ├── extend // 擴(kuò)展目錄 ├── public // WEB 部署目錄(對(duì)外訪問目錄) │ ├── index.php // 入口文件 │ ├── …… ├── runtime // 運(yùn)行時(shí)目錄 ├── thinkphp // 框架系統(tǒng)目錄 ├── vendor // 第三方類庫(kù)目錄 ├── .htaccess // 用于Apache的重寫 ├── composer.json // composer 定義文件 ├── LICENSE.txt // 框架授權(quán)協(xié)議文件 └── README.md // 框架說(shuō)明文件
- Root directory file function introduction
2.1 application
The application is located in the application directory of the framework. Each module has a corresponding subdirectory, including controllers, models, views and configuration files. Among them, the module common is the public module and index is the default module.
2.2 extend
The extend directory is used to store the extension class library of the framework. If you need to use additional class libraries or extensions, you can put them in this directory for easy management and calling.
2.3 public
The public directory is the root directory of the entire website, which stores files and resources for external access, such as css, js, images, etc. index.php is the entry file for the entire website, and all requests will be processed by this file first.
2.4 runtime
The runtime directory is used to store files when the framework is running, including cache files, log files, session files, etc. In a production environment, you should ensure that only programs have write permission to this directory to avoid security risks.
2.5 thinkphp
The thinkphp directory is the core of the entire framework, including common components such as controllers, models, views, etc., which can be used directly. Files in this directory cannot be modified or deleted, otherwise the framework will not function properly.
2.6 vendor
The vendor directory is the storage directory for third-party class libraries, which mainly includes class libraries installed by composer and self-written class libraries. Used to store and manage third-party expansion packages.
2.7 .htaccess
.htaccess file is used for Apache rewrite rule definition. In thinkPHP, this file is used to implement functions such as URL rewriting and request routing.
2.8 composer.json
The composer.json file is the definition file of composer, which is used to describe project dependencies and loading methods. It is needed when using composer to build the framework.
2.9 LICENSE.txt
LICENSE.txt is the framework’s authorization agreement file, which contains the intellectual property rights and usage agreement about the framework.
2.10 README.md
README.md is the description file of the framework, which is used to introduce the usage and features of the framework.
- Summary
The above is an introduction to the root directory of the thinkPHP framework. I hope it can be helpful to thinkPHP developers. In actual project development, understanding the root directory structure and file functions of the framework can help us carry out project development work more quickly and improve development efficiency and speed.
The above is the detailed content of What is the thinkPHP root directory?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)