我正在尝试在php中为Meteor应用程序设置一个注册表单,然后将用户添加到Meteor.users集合中。我可以将我的数据存入集合,但它无法在Meteor中找到我的用户,因为我无法获得正确的语法。
以下是我插入用户信息的方式;
/*
This is what I need it to look like
"emails" : [{
"address" : "demo@demo.com",
"verified" : false
}]
*/
try {
$db = $mongoConn->xhTforp;
$collection = $db->users;
$user = array("username" => $_POST['username'], "emails" => array( "address" => $_POST['email'], "verified" => true ), "services" => array ( "password" => array( "srp" => "Meteor._srp.generateVerifier(".$_POST['password'].")" )));
$collection->insert($user);
} catch (MongoException $e) {
die('Error: ' . $e->getMessage());
}
/*
Here what I get
"emails" : {
"address" : "demo@demo.com",
"verified" : true
},
"services" : {
"password" : {
"srp" : "Meteor._srp.generateVerifier(password)"
}
}
我无法弄清楚如何使用[{}]
语法? (仅供参考,我不知道密码部分是做什么的,这是我在这里找到的东西)