略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: MongoDB::selectCollection

2024-05-05

MongoDB::selectCollection

(PECL mongo >=0.9.0)

MongoDB::selectCollectionGets a collection

说明

public MongoDB::selectCollection ( string $name ) : MongoCollection

参数

name

The collection name.

返回值

Returns a new collection object.

错误/异常

Throws Exception if the collection name is invalid.

add a note add a note

User Contributed Notes 1 note

up
-17
asuquo dot ulo at techxion dot com
4 years ago
A simple script that selects a db and collection.

$m = new MongoClient();
   echo "Connection to database successfully<br>";
   // select a database
   $db = $m->test;
   echo "Database test selected<br>";
//select a Collection
   $collection = $db->selectCollection("member");
   echo "Collection member selected succsessfully<br>";
  
?>

官方地址:https://www.php.net/manual/en/mongodb.selectcollection.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3