Home >Backend Development >PHP Tutorial >php framework - How does CodeIgniter's model correspond to a specific data table, similar to thinkphp's real_tableName?

php framework - How does CodeIgniter's model correspond to a specific data table, similar to thinkphp's real_tableName?

WBOY
WBOYOriginal
2016-07-06 13:52:32871browse

Because I want to connect to a forum system. This system is made using CI. The user table of the original system is not called users, and it is impossible for me to rename the user table (in this case, the original system will have to be changed. At that time MVC is not very good), so I want to change this forum system, but the model name of codeigniter seems to be the corresponding table name, and there is no other way

Reply content:

Because I want to connect to a forum system. This system is made using CI. The user table of the original system is not called users, and it is impossible for me to rename the user table (in this case, the original system will have to be changed. At that time MVC is not very good), so I want to change this forum system, but the model name of codeigniter seems to be the corresponding table name, and there is no other way

CI’s model layer is very free, you can even operate all data tables in one model layer

It doesn’t matter what the class name of the model layer is. The key to what table you want to operate depends on how you write the code
for example

<code class="php">$this->db->select('title')->from('users')->get();</code>

is the operation users table. The table prefix is ​​configured in config/database.php

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