我的一个应用程序使用了带有旧php版本的MongoDB客户端库。我刚刚升级了我的php版本以及升级的mongo库。当下面的函数正在调用时,它给了我
致命错误:未定义错误:调用未定义方法MongoDB\Driver\游标::hasNext
function get_result_row () {
if ($this->cursor->hasNext()) {
return $this->cursor->getNext();
}
}我怎么才能修好它?
发布于 2019-12-28 12:16:41
试着改变这一点:
/* $cursor now contains an object that wraps around the result set. Use
* foreach() to iterate over all the result */
foreach($this->cursor as $document) {
//Do here your logic or try
//return $document;
print_r($document);
}https://www.php.net/manual/en/class.mongodb-driver-cursor.php
https://stackoverflow.com/questions/59509031
复制相似问题