thinkphp Learning Notes 1-directory structure and naming rules

Source: Internet
Author: User
Tags array empty extend lowercase net php and php framework version
Recently began to learn thinkphp, in the next, a lot of problems can not understand so want to take out, I dare to send on the home page, I hope to see people can answer questions for me, so that everyone has an interaction, learn to quickly, do not have any other means, the so-called live to old, learn old, I hope you do not laugh ah.   My approach is very simple, first from the manual, the manual is the development of the thinkphp author of the results of hard work, but some places are not understand, if you are fortunate to have encountered similar problems hope to be able to reply.         1. Framework directory   in Chapter 1.6 directory structure, the contents are as follows: The new version of the directory structure of   on the original based on the adjustment, clearer.   Directory/File Description thinkphp.php Framework entry file Common framework common file directory Conf Framework profile Directory Lang Framework System language Directory LIB system core base Class Library directory TPL System template directory Extend framework extension directory (about expanding For more information on the catalogue, please refer to the extended section below. 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 thinkphp directory in the main directory, the main content as mentioned above, screenshot below Figure 1:       Figure 1   can find the system core base class library is not called LIB, this is the library, The directory mentioned extend, said to be the framework extended directory, and also specifically prompted in the core version of this directory is empty, but I ThinkPHP3.2.2 the core and ThinkPHP3.2.2 full version of these two versions did not find this extend directory. Screenshots are as follows:       Figure 2. Full directory       Figure 3. Core Catalog   If we open the entire directory to see the following content, if 4       Figure 4 . Full catalog   Here we can see other file directories, but fortunately the authors put a readme.md file in the directory other than the frame directory thinkphp to tell us what this directory does,   1.Application: Project directory 2.Public: Resource file directory, should put css,js and picture 3.ThinkPHP: Frame directory, this is the core class capacity here 4..htaccess: A distributed configuration file, just contact this file feelIt's complicated, it's not specifically about the function of this file 5.index.phh: Portal file 6.readme.md: This Readme file       2. Naming rules   1. The class name ends with a. Class.php and is named after the hump, which is very rare for individuals, perhaps because the author is written for a period of time Java to write this framework, the Java some of the things to get here, so I am very rare, because I wrote a long time. NET, oh, I hate the following underlined words to name the way, feel Let people read an array of underlined, hemp not trouble, read a few words directly than to read an array simple Ah, but this underlined the way the name is the PHP inventor's habit, we have to reluctantly accept.   2. Case, I remember that custom variables in PHP are case-sensitive, other do not distinguish, but in order to avoid us in the case of the switch between the words, the suggestion or distinction, I think can use lowercase as far as possible, do English reading at school do not bother to appear in the words of capital, there is wood?   3. The class name and file name are consistent, this is also the hands of praise, so see the file name will know the class name, and. NET is so prescribed.   4. The name of the function is underlined in lowercase letters such as: GET_CLIENT_IP, why not use hump or Pascal naming way, this is not more in line with reading habits.   5. Constants, language parameters, configuration parameters are uppercase letters underlined, the same not accustomed to read up the brain.    

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: info-contact@alibabacloud.com 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.