thinkphp Learning Note 1-directory structure and naming rules _php Tutorial

Source: Internet
Author: User
Recently began to learn thinkphp, in the next, a lot of problems do not understand so I want to take out, I would like to be bold in the homepage, I hope to see people can answer questions for me, so that we have an interaction, learn quickly, do not have his meaning, so-called live to the old, learn old, hope you don't laughed at AH. My approach is very simple, starting from the manual, the manual is the development of thinkphp author hard work results, but some places are not understand, if you are fortunate to encounter similar problems hope to reply. 1. The framework catalogue in chapter 1.6 of the directory structure, the content is as follows: The new version of the directory structure on the original basis of the adjustment, more clear. Catalog/File Description thinkphp.php Frame entry File Common Framework Common Files Directory conf Framework configuration file Directory Lang Framework System Language Directory Lib System core base Class library catalog TPL System Template Catalog Extend Framework Extensions directory (for more information on extended directories, refer to the Extensions section later) Note: If you are downloading a core version, it is possible that the extend directory is empty because the thinkphp itself does not depend on any extensions. If we open the main directory of the thinkphp directory, the main content as described above, such as 1: Figure 1 can be found that the system core base Class library has not been called Lib, here is the library, open mentions extend this directory, said to be the framework extension directory, and also special hints in the core version of this directory is empty , but I did not find this extend directory in the two versions of ThinkPHP3.2.2 core and ThinkPHP3.2.2 full version. as follows: Figure 2. Full Catalog Figure 3. Core Catalog If we open the entire directory to see the contents below, if 4 Figure 4. Full catalogue Here we can see the other file directories, Fortunately, the author put a file in a directory other than the framework directory thinkphp to tell us what this directory is for, 1. Application: Project directory 2.Public: Resource files directory, should put css,js and picture 3.ThinkPHP: Frame directory, this is the core class to put in here 4. Htaccess: A distributed configuration file, just touch this file feel very complex, here does not specifically say the function of this file 5.index.phh: Entry file This Readme file 2. naming rule 1. The class name ends with a. Class.php and is named after the hump, which is very rare, perhaps because the author wrote Java for a while to write the framework, and some things in Java to get here, so I am very rare, because I wrote for a long time. NET, hehe, hated the following line of words to name the way, feel Let a person read an array of the following underlined, hemp is not troublesome, directly read a few words than to read an array simple Ah, but the way to name the underscore PHP is the habit of the inventor, we have to reluctantly accept. 2. Case, I remember that the custom variables in PHP are case-sensitive, the others do not distinguish, but in order to avoid the case we switch between the words, suggest or distinguish, I think I can use lowercase as far as possible in lowercase, go to school to do English reading comprehension there is no very annoying to appear uppercase words, have wood? 3. The class name and file name are consistent, and this one also likes to see the file name to know the class name, as well as the. NET rules. 4. The name of the function is underlined in lowercase letters such as: GET_CLIENT_IP, why do not use the hump or Pascal naming method, this is not more in line with the reading habits. 5. Constants, language parameters, configuration parameters are uppercase and underlined, the same is not customary,It costs brains to read. true techarticle recently began to learn thinkphp, in the next no, a lot of problems do not understand so want to take out, I would like to be bold in the homepage, I hope to see the people can answer questions for me, so we have a mutual ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.