Home > PHP Framework > ThinkPHP > What is the thinkPHP root directory?

What is the thinkPHP root directory?

PHPz
Release: 2023-05-26 12:02:08
Original
1220 people have browsed it

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.

  1. Root directory structure

The root directory of thinkPHP framework mainly contains the following files and folders:

├── application       // 应用目录
│   ├── common        // 公共模块
│   ├── index         // 默认模块
│   └── ……
├── extend            // 扩展目录
├── public            // WEB 部署目录(对外访问目录)
│   ├── index.php     // 入口文件
│   ├── ……
├── runtime           // 运行时目录
├── thinkphp          // 框架系统目录
├── vendor            // 第三方类库目录
├── .htaccess         // 用于Apache的重写
├── composer.json     // composer 定义文件
├── LICENSE.txt       // 框架授权协议文件
└── README.md         // 框架说明文件
Copy after login
  1. 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.

  1. 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!

source:php.cn
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