(PECL mongo >=1.0.1)
MongoDB::authenticate — 锟斤拷录锟斤拷锟斤拷锟捷匡拷
This extension that defines this method is deprecated. Instead, the MongoDB extension should be used. There is no equivalent for this method in the new extension.
锟斤拷要锟斤拷锟斤拷证锟斤拷息锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷为锟斤拷锟芥。
$username
, string $password
) : array锟剿凤拷锟斤拷锟杰癸拷锟斤拷证锟斤拷锟斤拷锟斤拷锟接★拷 锟斤拷锟斤拷锟斤拷菘锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷证锟斤拷默锟斤拷没锟叫匡拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿何诧拷锟斤拷之前锟斤拷锟斤拷要锟斤拷录锟斤拷
通锟斤拷锟斤拷锟斤拷拢锟斤拷锟接︼拷锟绞癸拷锟� MongoClient::__construct() 锟斤拷锟矫的诧拷锟斤拷锟斤拷锟斤拷锟角此凤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷证锟剿o拷然锟斤拷锟节会话锟节硷拷锟斤拷锟接碉拷锟斤拷然锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷岜伙拷锟斤拷锟斤拷锟街わ拷锟� 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街讹拷锟斤拷证锟斤拷然锟斤拷锟斤拷锟接碉拷锟剿o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞憋拷侄锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
锟矫凤拷锟斤拷锟斤拷同锟斤拷锟斤拷锟叫o拷
<?php
$salted = "${username}:mongo:${password}";
$hash = md5($salted);
$nonce = $db->command(array("getnonce" => 1));
$saltedHash = md5($nonce["nonce"]."${username}${hash}");
$result = $db->command(array("authenticate" => 1,
"user" => $username,
"nonce" => $nonce["nonce"],
"key" => $saltedHash
));
?>
锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷证锟斤拷锟斤拷锟斤拷锟杰癸拷通锟斤拷 "logout" 锟斤拷锟捷匡拷锟斤拷锟斤拷锟斤拷锟角筹拷锟斤拷
<?php
$db->command(array("logout" => 1));
?>
username
锟矫伙拷锟斤拷锟斤拷
password
锟斤拷锟诫(锟斤拷锟侥革拷式锟斤拷锟斤拷
锟斤拷锟斤拷锟斤拷锟捷匡拷锟斤拷锟接︼拷锟斤拷锟斤拷锟斤拷录锟缴癸拷锟斤拷锟斤拷锟结返锟斤拷
<?php
array("ok" => 1);
?>
<?php
array("ok" => 0, "errmsg" => "auth fails");
?>
MongoDB 锟斤拷锟斤拷 » authenticate 锟侥猴拷锟斤拷锟侥碉拷锟斤拷
锟芥本 | 说锟斤拷 |
---|---|
1.2.11 |
使锟斤拷时锟斤拷锟斤拷 E_DEPRECATED 锟斤拷
锟诫将锟斤拷证细锟节达拷锟诫到锟斤拷锟斤拷锟斤拷锟斤拷
|