A framework written using PHP must have its own specifications, thinkphp and vice versa. Here are The naming conventions that should be followed as much as possible using thinkphp:
2 .class.php thinkphp internal use of the class library file, does not represent the externally loaded class library file), using the Hump method named, and capitalized, such as dbmysql.class.php
2 Other class library files, such as functions, configuration files, are generally .php
2 Ensure that the file naming and invocation are case-sensitive because the class unix above the system, the case is sensitive (and the thinkphp under debug mode, even in the windows platform will also strict check case ).
2, for example useraction useraction.class.php Infomodel InfoModel.class.php ,
2 The function is named using lowercase letters and underscores, such as get_client_ip
2 Action Controller class to Action is a suffix, for example useraction , infoaction
2 Model classes to Model is a suffix, for example Usermodel , Infomodel
2 the name of the method uses the Hump method, and the first letter is lowercase, for example GetUserName
2 The name of the property uses the Hump method, and the first letter is lowercase, for example tableName
2 Double underline " __ "The beginning of a function or method as a magical method, such as __call and the __autoload
2 constants are named with uppercase letters and underscores, such as has_one and many_to_many
2 The configuration parameters are named with uppercase letters and underscores, for example html_cache_on
2 language variables are named with uppercase letters and underscores, such as my_lang _class_not_exist_ .
2 data tables and fields are named with lowercase underscores, such as think_user and user_name
Exception:
in the thinkphp inside, there is a special case of a function name, which is a single-letter capitalization function , which is usually a shortcut to some operations, or a special function. For example, ADSL methods and so on, they have a special meaning, there will be some understanding.
another point, thinkphp Default Usage UTF-8 code, so make sure your program files are using the UTF-8 encoding format, and remove BOM Information Header (remove BOM header information in many ways, different editors have a setup method, you can also use the tool for unified detection and processing .
Source: >
From for notes (Wiz)
PHP Naming conventions