Home Backend Development PHP Tutorial thinkphp study notes 1—Directory structure and naming rules_PHP tutorial

thinkphp study notes 1—Directory structure and naming rules_PHP tutorial

Jul 13, 2016 am 10:28 AM
notes structure rule

I recently started learning thinkphp. I’m not very good at it. I don’t understand many of the questions, so I want to post them on the homepage. I hope people who see it can answer my questions, so that everyone can interact and learn faster. , I have no other intention. As the saying goes, live until you are old and learn until you are old. I hope you won’t laugh at it.

My approach is very simple. I start with the manual. The manual is the result of the hard work of the author who developed thinkphp, but there are some parts that I don’t understand. If you are lucky enough to encounter similar problems, I hope you can reply.
1.Framework directory
In Chapter 1.6 Directory Structure, the content is as follows:
The directory structure of the new version has been adjusted based on the original to make it clearer.
Directory/File Description
ThinkPHP.php Framework entry file
Common Framework public file directory
Conf Framework configuration file directory
Lang Framework system language directory
Lib System core base class library directory
Tpl System Template Directory
Extend Framework extension directory (for details about the extension directory, please refer to the extension chapter later)
Note: If you download the core version, the Extend directory may be empty, because ThinkPHP itself does not rely on any extensions.
If we open the ThinkPHP directory under the home directory, the main content is as mentioned above, and the screenshot is as shown in Figure 1:
Picture 1
It can be found that the system core base class library is no longer called Lib. This is Library. The Extend directory is mentioned at the beginning, and it is said to be a framework extension directory. It also specifically reminds that this directory is empty in the core version, but I This Extend directory is not found in both ThinkPHP3.2.2 core version and ThinkPHP3.2.2 full version. The screenshot is as follows:
Figure 2. Full version directory
Figure 3. Core version directory
If we open the entire directory, we will see the following content, if 4
Figure 4. Complete table of contents
Here we can see other file directories. Fortunately, the author has placed a README.md file in other directories except the framework directory ThinkPHP to tell us what this directory does,
1.Application: Project Directory
2.Public: resource file directory, which should contain css, js and pictures
3.ThinkPHP: Framework directory, this is where the core classes are placed
4..htaccess: A distributed configuration file. I find this file very complicated when I first come across it. I won’t go into details about the function of this file here
5.index.phh: Entry file
6.README.md: This readme file
2. Naming rules
1. The class name ends with .class.php and is named using camel case. This is very rare for me. It may be because the author has been writing Java for a while before writing this framework, and got some things in Java here. , so I am very curious, because I have been writing .net for a long time. Haha, I hate the way of naming words by dividing them with underscores. I feel that people have to read an array separated by underscores. It is not troublesome. Just read a few. Words are simpler than reading an array, but this underline naming method is a habit of the inventor of PHP, and we have no choice but to accept it.
2. Case, I remember that custom variables in php are case-sensitive, and others are not. But in order to avoid us switching between upper and lower case words, it is recommended to distinguish them. I think it can be used in lower case as much as possible. , when you were doing English reading comprehension in school, did you find it annoying that capitalized words appeared?
3. Keep the class name and file name consistent. This is also a thumbs up, so you can know the class name when you see the file name. This is also stipulated by .net.
4. Functions are named using lowercase letters and underlines, such as: get_client_ip. Why are there no camel case or pascal naming methods? Isn’t this more consistent with reading habits?
5. Constants, language parameters, and configuration parameters are all in capital letters and underlined, which is also unaccustomed and difficult to read.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/813066.htmlTechArticleI recently started learning thinkphp. I’m not very good at it. I don’t understand many of the questions, so I want to share them. Please forgive me for posting them boldly. On the homepage, I hope people who see it can answer my questions so that everyone can interact with each other...
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

Video Face Swap

Video Face Swap

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

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)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1238
24
How to delete Xiaohongshu notes How to delete Xiaohongshu notes Mar 21, 2024 pm 08:12 PM

How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

Can deleted notes on Xiaohongshu be recovered? Can deleted notes on Xiaohongshu be recovered? Oct 31, 2023 pm 05:36 PM

Notes deleted from Xiaohongshu cannot be recovered. As a knowledge sharing and shopping platform, Xiaohongshu provides users with the function of recording notes and collecting useful information. According to Xiaohongshu’s official statement, deleted notes cannot be recovered. The Xiaohongshu platform does not provide a dedicated note recovery function. This means that once a note is deleted in Xiaohongshu, whether it is accidentally deleted or for other reasons, it is generally impossible to retrieve the deleted content from the platform. If you encounter special circumstances, you can try to contact Xiaohongshu’s customer service team to see if they can help solve the problem.

What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found? What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found? Mar 21, 2024 pm 09:30 PM

As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of "What to do if the notes published by Xiaohongshu are missing" and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click "Me" → "Publish" → "All Publications" to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

How to connect Apple Notes on iPhone in the latest iOS 17 system How to connect Apple Notes on iPhone in the latest iOS 17 system Sep 22, 2023 pm 05:01 PM

Link AppleNotes on iPhone using the Add Link feature. Notes: You can only create links between Apple Notes on iPhone if you have iOS17 installed. Open the Notes app on your iPhone. Now, open the note where you want to add the link. You can also choose to create a new note. Click anywhere on the screen. This will show you a menu. Click the arrow on the right to see the "Add link" option. click it. Now you can type the name of the note or the web page URL. Then, click Done in the upper right corner and the added link will appear in the note. If you want to add a link to a word, just double-click the word to select it, select "Add Link" and press

How to add product links in notes in Xiaohongshu Tutorial on adding product links in notes in Xiaohongshu How to add product links in notes in Xiaohongshu Tutorial on adding product links in notes in Xiaohongshu Mar 12, 2024 am 10:40 AM

How to add product links in notes in Xiaohongshu? In the Xiaohongshu app, users can not only browse various contents but also shop, so there is a lot of content about shopping recommendations and good product sharing in this app. If If you are an expert on this app, you can also share some shopping experiences, find merchants for cooperation, add links in notes, etc. Many people are willing to use this app for shopping, because it is not only convenient, but also has many Experts will make some recommendations. You can browse interesting content and see if there are any clothing products that suit you. Let’s take a look at how to add product links to notes! How to add product links to Xiaohongshu Notes Open the app on the desktop of your mobile phone. Click on the app homepage

What are the syntax and structure characteristics of lambda expressions? What are the syntax and structure characteristics of lambda expressions? Apr 25, 2024 pm 01:12 PM

Lambda expression is an anonymous function without a name, and its syntax is: (parameter_list)->expression. They feature anonymity, diversity, currying, and closure. In practical applications, Lambda expressions can be used to define functions concisely, such as the summation function sum_lambda=lambdax,y:x+y, and apply the map() function to the list to perform the summation operation.

Rules and exceptions for pointer comparisons? Rules and exceptions for pointer comparisons? Jun 04, 2024 pm 06:01 PM

In C/C++, the pointer comparison rules are as follows: pointers pointing to the same object are equal. Pointers to different objects are not equal. Exception: Pointers to null addresses are equal.

In-depth analysis of the structure and purpose of the MySQL.proc table In-depth analysis of the structure and purpose of the MySQL.proc table Mar 15, 2024 pm 02:36 PM

The MySQL.proc table is a system table that stores stored procedure and function information in the MySQL database. By in-depth understanding of its structure and purpose, you can better understand the operating mechanism of stored procedures and functions in MySQL, and perform related management and optimization. The structure and purpose of the MySQL.proc table will be analyzed in detail below, and specific code examples will be provided. 1. The structure of the MySQL.proc table. The MySQL.proc table is a system table that stores the definitions and related information of all stored procedures and functions.

See all articles