thinkphp Naming conventions

Source: Internet
Author: User
directory and file naming directories and filenames are lowercase + underlined and start with lowercase letters; class libraries, The function file is unified with. php suffix, the file name of the class is defined in the namespace, and the path of the namespace is consistent with the path of the class library file (including case), the class name and class file name are consistent, and uniform use of the camel name (first capitalization) class, method and property naming class named Using Hump method, and the first letter capitalization, such as user, usertype; method name using Hump method, and the first letter lowercase or use underscore "_", such as getusername,_parsetype, usually the method of the beginning of the underscore is a private method, the name of the property using the Hump method, and the first letter lowercase or use underscore "_", for example TableName, _instance, the attribute usually beginning with underscore is private property; a function or method preceded by a double underscore "__" as a magic method, such as __call and __autoload A function named function is named using lowercase letters and underscores (beginning with lowercase letters), such as get_client_ip; constant named constants are named with uppercase letters and underscores, such as App_debug and App_mode; Configure named configuration parameters to be named with lowercase and underscores, for example url_route_on; Data table and field named Data tables and fields are named in lowercase and underlined, and note that field names do not begin with an underscore, such as the Think_user table and User_name fields, which are likely to be filtered by a data table field like _username. Apply the Class Library namespace specification to apply the root namespace of the class library uniformly to the app (you can set app_namespace changes); For example: App\index\controller\index and App\index\model\user. 

thinkphp Naming conventions

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.