PHP Doku:: Gets a database - mongo.get.html

Verlauf / Chronik / History: (6) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenMongoDB Native DriverCore ClassesThe Mongo classMongo::__get

Ein Service von Reinhard Neidl - Webprogrammierung.

The Mongo class

<<Mongo::dropDB

Mongo::getHosts>>

Mongo::__get

(PECL mongo >=1.0.2)

Mongo::__getGets a database

Beschreibung

public MongoDB Mongo::__get ( string $dbname )

This is the cleanest way of getting a database. If the database name has any special characters, Mongo::selectDB() will need to be used. However, in most cases, this should be sufficient.

<?php

$mongo 
= new Mongo();

// the following two lines are equivalent
$db $mongo->selectDB("foo");
$db $mongo->foo;

?>

Parameter-Liste

dbname

The database name.

Rückgabewerte

Returns a new db object.

Fehler/Exceptions

Throws a generic exception if the database name is invalid.


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)