我收到此错误消息:
Deprecated: Function Mongo::setSlaveOkay() is deprecated
在PHP manual ,它说:
MongoCollection::setSlaveOkay
(PECL mongo >=1.1.0)
MongoCollection::setSlaveOkay — Change slaveOkay setting for this collection
我找不到任何关于它被弃用的内容。
我的PHP版本是5.3.10,MongoDB版本是1.3.5。
最佳答案
正如其他答案所述,setSlaveOkay
已被弃用,取而代之的是完全阅读偏好 (http://derickrethans.nl/readpreferences.html)。这是在引入 MongoClient
类时所做的更改 (http://derickrethans.nl/mongoclient.html)。
如果您查看 PHP 手册页 (http://www.php.net/manual/en/mongocollection.setslaveokay.php) 的底部,您会看到一个变更日志部分,其中提到:
Emits E_DEPRECATED when used.
下面的“另见”部分提供了替换它的链接,阅读首选项。
作为备份 Hannes ( https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/CAWuND9niLo ),维护者之一,提到:
We wanted to prepare people that the preferred way [...] will change in the upcoming 1.3.0 release (scheduled "soon").
是的,从现在开始您应该使用阅读首选项。
关于php - setSlaveOkay 已弃用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15561335/