How does ThinkPHP5 control how to connect to different databases?

demand: for Testin platform, testers to test, but does not affect the production environment of the database, you need to use a test list background, if the merchant number or logo exists on the list, connect to another test server database.

current situation: IOS, Android and H5 call the relevant APIs, while the APIs connect to different projects and databases. If there is any way, try to switch database connections between these three ends without much modification?

solution: when IOS, Android and the frontend call the API, header is globally set with the version number information to identify the specified agent and version number, and provide the backend to identify and determine whether to connect to the test server database.

Mar.04,2022

if you connect to different databases when requesting ios or android,h5, judge according to userAgent, and then get different database configurations


Hello, have you solved this problem? I'm also looking for answers.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34886-2ac66.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34886-2ac66.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?