本文实例讲述了ThinkPHP实现非标准名称数据表快速创建模型的方法。分享给大家供大家参考。具体方法如下:
非标准名称数据表,例如:cow_archives_4,类似命名方法常见于齐博cms,08cms等文档模型数据表命名,假设已在配置文件中配置数据表前缀:
return array(
//'配置项'=>'配置值'
//数据库配置
'DB_PREFIX'=>'cow_',
);
?>
新建模型,Archives4Model.class.php
class Archives4Model extends Model{
protected $tableName = 'archives_4';
}
?>
D方法实例化:
$archives4=D("Archives4");
$rsdb=$archives4->select();
var_dump($rsdb);
希望本文所述对大家的ThinkPHP框架程序设计有所帮助。
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn