本文整理汇总了PHP中MongoClient::getAuthKey方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoClient::getAuthKey方法的具体用法?PHP MongoClient::getAuthKey怎么用?PHP MongoClient::getAuthKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoClient
的用法示例。
在下文中一共展示了MongoClient::getAuthKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auth
/**
* Sends authenciation packet
* @param array Hash of properties (dbname, user, password, nonce)
* @param mixed Callback called when response received
* @param string Optional. Distribution key
* @return void
*/
public function auth($p, $callback, $key = '')
{
if (!isset($p['opts'])) {
$p['opts'] = 0;
}
$query = array('authenticate' => 1, 'user' => $p['user'], 'nonce' => $p['nonce'], 'key' => MongoClient::getAuthKey($p['user'], $p['password'], $p['nonce']));
$packet = pack('V', $p['opts']) . $p['dbname'] . '.$cmd' . "" . pack('VV', 0, -1) . bson_encode($query) . (isset($p['fields']) ? bson_encode($p['fields']) : '');
$reqId = $this->request($key, self::OP_QUERY, $packet, true);
$this->requests[$reqId] = array($p['dbname'], $callback, true);
}