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?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-06 13:52:32
Original
891 people have browsed it

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

$this->db->select('title')->from('users')->get();
Copy after login

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

Related labels:
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template