Thinkphp D method
The D method is used to instantiate a custom model class, is an encapsulation of the model class instantiation by the thinkphp framework, and implements a singleton pattern that supports cross-project and group calls in the following format:
D (' [Project://][Group/] model ', ' model layer name ')
The return value of the method is the instantiated model object.
references : thinkphp function: D method http://www.thinkphp.cn/info/122.html
thinkphp Custom Template Labels
references : thinkphp Customizing template tags in detail http://w3note.com/web/124.html
thinkphp model
The role of model classes In most cases is to manipulate the data table, if you follow the system specification to name the model class, in most cases it is possible to automatically correspond to the data table .
===========================
Model classes are usually \think\model classes that inherit the system, and the schema method of the class has three parameters, namely:
Model ([' model name '],[' data table prefix '],[' database connection information ']);
Three parameters are optional, and in most cases we don't need to pass in any parameters to instantiate them.
| Parameters |
Description |
| Model name |
The name of the model is combined with the data table prefix to automatically identify the data table name |
| Data table prefixes |
The current data table prefix and model name are used together to automatically identify the data table name |
| Database connection Information |
Database connection information for the current data table if not, gets the
|
===========================
M method
When the D method instantiates a model class, it is usually instantiated with a specific model class, and if you are simply curd the data table, using the M method instantiation, the performance will be higher because you do not need to load the specific model class.
reference : Model instantiation Http://document.thinkphp.cn/manual_3_2.html#model_instance
ThinkPHP-4-Study notes (2015.4.12)