这篇文章主要介绍了ThinkPHP实现非标准名称数据表快速创建模型的方法,对于采用ThinkPHP操作非标准名称数据表的情况非常实用,具有一定的参考借鉴价值,需要的朋友
本文实例讲述了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框架程序设计有所帮助。
,
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
