Home  >  Article  >  Backend Development  >  Solution to PHP link mongodb link interruption

Solution to PHP link mongodb link interruption

不言
不言Original
2018-05-04 15:18:121843browse

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!

Statement:
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
Previous article:socket function in PHPNext article:socket function in PHP