Home  >  Article  >  php教程  >  TP5 Model sets the data table so that you no longer kneel

TP5 Model sets the data table so that you no longer kneel

WBOY
WBOYOriginal
2016-10-17 09:12:042353browse

fuck the Official CODE
The manual says,
//Set the complete data table name corresponding to the current model
protected $table = 'think_user';

Why not user and add the prefix manually? So why set this thing up?

Manually change the Model
//Set the current data table and model name
if (!empty($this->table)) {
$query->setTable($query->getConfig('prefix') . $this->table);

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
Previous article:110 custom php functionsNext article:110 custom php functions