我使用的是Windows 10 64位,xampp 3.2.2,PHP 5.6.30,PHP Extension Build VC11,MongoDB服務器版本:3.4.3。如何解決致命錯誤:類'MongoClient'找不到?
我越來越喜歡 「致命錯誤:類 'MongoClient' 在d未發現:4號線\ XAMPP \ htdocs中\測試\ test1.php」 的錯誤。
這裏是我使用
CODE
<?php
// connect
$m = new MongoClient();
// select a database
$db = $m->cabin;
// select a collection (analogous to a relational database's table)
$collection = $db->user;
// find everything in the collection
$cursor = $collection->find();
// iterate through the results
foreach ($cursor as $document) {
echo $document["title"] . "\n";
}
?>
我已經添加在php.ini (D:\xampp\php)
「延長= php_mongodb.dll」 文件夾中(D:\xampp\php\ext)
dll文件,並添加擴展的代碼。但問題沒有解決。
的MongoDB(蒙戈分貝正在工作)
[email protected] MINGW64 /d
$ mongo
MongoDB shell version v3.4.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.3
use cabin
switched to db cabin
show tables
bmessages
booking
cabins
club
country
customer
email
facilities
land
mschool
region
role
rooms
settings
tempuser
tour
user
userold
visit