ThinkPHP implements a method to quickly create models for non-standard name data tables, thinkphp model
The example in this article describes how ThinkPHP implements non-standard name data tables to quickly create models. Share it with everyone for your reference. The specific method is as follows:
Non-standard name data table, for example: cow_archives_4, similar naming methods are common in Qibo cms, 08cms and other document model data table naming. It is assumed that the data table prefix has been configured in the configuration file:
Copy code The code is as follows:
return array(
//'Configuration item'=>'Configuration value'
//Database configuration
'DB_PREFIX'=>'cow_',
);
?>
New model,Archives4Model.class.php
Copy code The code is as follows:
class Archives4Model extends Model{
protected $tableName = 'archives_4';
}
?>
D method instantiation:
Copy code The code is as follows:
$archives4=D("Archives4");
$rsdb=$archives4->select();
var_dump($rsdb);
I hope this article will be helpful to everyone’s ThinkPHP framework programming.
http://www.bkjia.com/PHPjc/919617.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/919617.htmlTechArticleThinkPHP’s method of quickly creating a model for non-standard name data tables, thinkphp model. This article describes the example of ThinkPHP’s implementation of non-standard names. A quick way to create models from data tables. Share with everyone...