update : 2015.11.03
php.shukuma.com

검색:
 
 
Gets a database

MongoClient::__get

(PECL mongo >=1.3.0)

MongoClient::__getGets a database

설명

public MongoDB MongoClient::__get ( string $dbname )

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.