【Foreword】
Today I saw a database table prefix setting in the database configuration under the Tp system configuration file
【main body】
/* database settings */ 'DB_PREFIX' => '', // Database table prefix. For example sp_user, prefixed with sp
I checked online, and the specific origin starts from a few years ago.
Compared with today's simple and practical Alibaba Cloud, Tencent Cloud, Huawei Cloud, etc., virtual hosts were used before.
And there are too many permissions restrictions. When creating a data table, if there are multiple items, in order to avoid confusion and duplicate names, and to improve readability, a prefix is added before the data table.
Such as: mall system sc_user
sc_member
sc_goods
OA 系统 oa_user
oa_news
In order to distinguish the two, a prefix is added.
In this way, even if multiple projects are placed in one library, they can still be clearly identified.
Even if the effect is not as obvious now, this habit is still carried over to the present
In a more complex system, the module and category where the table is located can be roughly understood by the prefix of the table name. This is convenient for daily development and operation and maintenance. Newcomers also have rules to follow when they understand the system data structure.
.