. field Cache Settings
The TP framework executes the field information in the data table, the SQL statement can query "show colums from Table", in performance consideration, you can cache the field, avoid repeating the SQL statement every time.
4. The current model model can be personalized according to the situation
Three ways to instantiate the model:
- $goods = new namespace Goodsmodel ();
- $goods = D (' model sign ');
a) $goods = D ("goods");
b) The $goods is the object of the parent model, but the data table of the operation is still sw_goods
c) $obj = D (); Instantiate the model object with no specific operational data tables, consistent with the M () method effect
3. $obj = M ();
A) instantiation of the parent class model
b) You can directly invoke the properties inside the parent model to get database related operations
c) Custom model is an empty shell, there is no need to instantiate a custom model
d) $obj = M (' Data sheet sign '); Instantiate the model object and actually manipulate the specific data table
$obj = D (sign);
$obj = D ();
$obj = M (sign);
$obj = M ();
The difference between the D () and M () methods:
The former is a simplified method for new operation in tp3.1.3;
The latter is used to instantiate the model parent class
Both are defined in the function library file thinkphp/common/functions.php
Note: If there is no corresponding model model file class, you can also instantiate the model object directly for operation
Both the D () and M () methods can be instantiated to manipulate a data table that does not have a specific model class file.