本文整理匯總了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);
}