This paper describes the method of thinkphp to create a model for non-standard name data tables quickly. Share to everyone for your reference. Here's how:
Non-standard name data tables, such as: Cow_archives_4, naming methods common Uzibo cms,08cms such as document model data tables, assume that a data table prefix has been configured in the configuration file:
The code is as follows:
<?php
Return Array (
' Config item ' = ' config value '
Database configuration
' Db_prefix ' = ' cow_ ',
);
?>
New Model , Archives4Model.class.php
The code is as follows:
<?php
Class Archives4model extends model{
protected $tableName = ' archives_4 ';
}
?>
D Method Instantiation:
The code is as follows:
$archives 4=d ("Archives4");
$rsdb = $archives 4->select ();
Var_dump ($RSDB);
It is hoped that this article will be helpful to everyone's thinkphp framework design.