Home >Backend Development >PHP Tutorial >Major discovery of the BUG in the name prefix of the cross-database mapping relationship table in the Discuz DB layer, discuz relationship table_PHP tutorial
Scenario:
Create a Table model in Discuz, but the Table is not in the same library as Discuz.
Discuz seems to provide a cross-library mapping mechanism after version 3.
There is no problem with the mapping. The main reason is that the table name prefix is not mapped accordingly. Of course, it's not actually a bug. Because he only considers discuz's own system, generally speaking, the table name prefixes are the same.
In the db driver class, db_driver_mysql(i):
Append code to function table_name
<span>if</span>(!<span>empty</span>(<span>$this</span>->config[<span>$id</span>]['tablepre'<span>])){ </span><span>$this</span>->tablepre = <span>$this</span>->config[<span>$id</span>]['tablepre'<span>]; }</span>