- /**
- * 获取MongoDB数据大小
- * @return string
- */
- function getMongodbSize()
- {
- $m = new Mongo();
- $db = $m->selectDB("数据库名");
- $res = $db->execute("return db.stats()");
- return ($res["retval"]["storageSize"] / 1024 / 1024) . "MB";
- }
- //该片段来自于http://www.codesnippet.cn/detail/290920136246.html
来源: http://www.codesnippet.cn/detail/290920136246.html