search
HomeheadlinesIllustrated ThinkPHP5 framework (1): basic knowledge, development specifications and directory structure

Based on the latest ThinkPHP5.0.8, it was originally produced by xmind mind map. If you feel that the picture is not clear, you can download the xmind source file and open it with xmind software.

In addition, the source code used in the mind map is all in the map notes. You can only see it if you download the xmind source file.

Students who want to learn ThinkPHP5 development by themselves must not miss this benefit. Programmers who are working on the ThinkPHP5 project development can save it for future inquiries

1. Mind map: (It is recommended to click on the picture to open a new page for viewing or download it for local viewing)

Illustrated ThinkPHP5 framework (1): basic knowledge, development specifications and directory structure

2. Text description of the map:

thinkphp5 basics

1 What is tp5?

1.1 Free and open source, fast and simple object-oriented lightweight PHP development framework

1.2 Simple and practical, with minimal code, allowing it to be used to develop commercial projects

1.3 A new architecture, compared with version 3.2, is a brand new product

1.4 tp5 is suitable for new project development, not suitable for old project upgrades

2 Installation method

2.1 Official website Download: thinkphp.cn, core version and full version are provided

2.2 composer installation:

2.2.1 windows: you need to download the composer tool

2.2.2 mac or linux :Terminal tool online installation

2.3 git installation (recommended):

3 Development specifications

3.1 Naming specifications

3.1.1 Camel case nomenclature: by Multiple words with capital letters

Big hump: The first letter of the first word is capitalized

Small hump: Except for the first word, the first letter of each other word is capitalized

3.1.2 Hungarian nomenclature: use _underscores to connect words

Prefix: the first word is a prefix or prefix abbreviation, indicating the type or function: o_Div

Meaningless: between multiple words Underscores are used in intervals, purely to separate words, without clear meaning: user_name

3.2 Directory and file

3.2.1 Directory: lowercase letters + underline: app_index

3.2 .2 Class libraries and function files are uniformly suffixed with .php: func.php

3.2.3 Class file names are defined in namespaces, and the path of the namespace is consistent with the path of the class library file

3.2.4 Class file name: CamelCase naming, consistent with the class name,

3.2.5 Class file name: CamelCase, other files are named in lowercase + underline: User, my_file.php

3.3 Functions, classes, and attribute naming

3.3.1 Use lowercase letters and underlines for functions: get_user_level()

3.3.2 All methods and attributes in the class use lowercase letters. Camel case: getUserName(), tableName

3.3.3 All magic methods in the class begin with double underscores, consistent with PHP official requirements: __callStatic()

3.4 Constants and configuration

3.4.1 Constants: uppercase letters + underline, APP_PATH

3.4.2 Configuration parameter name: lowercase letters + underline, url_route_on

3.5 Data tables and fields

3.5.1 Lowercase letters + underline: user_table

4 Directory structure

mark: The directory structure can be customized

4.1 application: application directory

1 common: public module directory (Optional and can be changed to inaccessible)

2 extra: extension module

3 index:default module

4 module_name:user module

4.1 config. php:Module configuration file

4.2 common.php:Module function file

4.3 controller:Controller directory

4.4 model:Model directory

4.5 view :View directory

5 command.php:Command line tool configuration file

6 common.php:Public function file

7 config.php:Public configuration file

8 database.php: Database configuration file

9 route.php: Routing configuration file

10 tags.php: Application behavior extension file

4.2 extend: extension Directory (empty)

4.3 public: Web deployment directory, externally accessible

4.3.1 static directory: static resource library (css, js, image)

4.3. 2 index.php: Application entry file

4.3.3 router.php: Used for PHP’s own webserver support and can be used for quick testing

4.3.4 robots.txt: Search engine crawler file

4.3.5 .htaccess: used for apache rewrite file

4.4 runtime: application running directory

4.4.1 log: log directory

4.4 .2 Temporarily generated files

4.5 thinkphp:framework system directory

4.5.1 lang:language pack directory(zh-cn)

4.5.2 library:framework core Class library directory

1 think class library package directory

2 System Traits directory

4.5.3 tpl: System template directory

1 default_index.tpl: Default homepage template

2 dispatch_jump.tpl: Page jump template

3 page_trace.tpl: Page debugging information display template

4 think_exception.top: Page exception information template

4.5.4 CONTRIBUTING.md: How to contribute your code

4.5.5 LICENSE.txt: License Agreement

4.5.6 README.md:readme file

4.5.7 base.php:Basic definition file

4.5.8 console.php:Console entry file

4.5.9 convertion.php:Framework convention configuration file

4.5.10 helper.php: Helper function file

4.5.11 phpunit.xml: phpunit configuration file (related to tests directory)

4.5.12 start.php: Framework entrance File (load base.php file)

4.6 vendor: third-party library directory

4.7 tests: test directory, you can ignore it for now

4.8 build.php :Automatically generate definition files (reference)

4.9 composer:composer definition file

4.10 think:Command line entry file

4.11 LICENSE.txt: Authorization description file

4.12 README.md: Description file written in MarkDown

3. Mind map source file download (xmind format):

Illustrated ThinkPHP5 framework (1): basic knowledge, development specifications and directory structure##1.tp5 basics. xmind.zip

【Related recommendations】

1.

Illustration of ThinkPHP5 framework (2): Application running process and life cycle

2 .

Illustrated ThinkPHP5 framework (3): Configuration class Config.php source code interpretation

3.

The latest 10 thinkphp video tutorial recommendations in 2017

Statement
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

Video Face Swap

Video Face Swap

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

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment