Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17816 программистов и 1567 роботов. Сейчас ищут 933 программиста ...
MongoClient::__get - Gets a database
Вернуться к: MongoClient
MongoClient::__get
(PECL mongo >=1.3.0)
MongoClient::__get — Gets a database
This extension that defines this method is deprecated. Instead, the MongoDB extension should be used. There is no equivalent for this method in the new extension, but there is an alternative in the PHP library:
Описание
This is the cleanest way of getting a database. If the database name has any special characters, MongoClient::selectDB() will need to be used; however, this should be sufficient for most cases.
<?php
$mongo = new MongoClient();
// the following two lines are equivalent
$db = $mongo->selectDB("foo");
$db = $mongo->foo;
?>
Список параметров
-
dbname
-
The database name.
Возвращаемые значения
Returns a new db object.
Ошибки
Throws a generic exception if the database name is invalid.
Вернуться к: MongoClient