Home > Article > Backend Development > Solution to PHP link mongodb link interruption
This article mainly introduces the solution to the sometimes interrupted link of php link to mongodb. It has a certain reference value. Now I share it with you. Friends in need can refer to it
Mognodb database connection method
Standard connection
$m = new Mongo(“mongodb://${username}:${password}@localhost:${port}”);
Other connections
$m = new Mongo(“mongodb://localhost:${port}/${username}:${password}”);
Sometimes (frequently refreshed) links Switch link mode when interrupted
##
The above is the detailed content of Solution to PHP link mongodb link interruption. For more information, please follow other related articles on the PHP Chinese website!