本文整理汇总了PHP中Parse\ParseUser::setArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseUser::setArray方法的具体用法?PHP ParseUser::setArray怎么用?PHP ParseUser::setArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseUser
的用法示例。
在下文中一共展示了ParseUser::setArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uniqid
require 'js/parse/autoload.php';
require_once "config.php";
require_once "common.php";
use Parse\ParseException;
use Parse\ParseUser;
use Parse\ParseSessionStorage;
use Parse\ParseClient;
use Parse\ParseQuery;
$func = $_POST['check'];
if ($func == 'guest') {
(string) ($uniq = uniqid());
$name = "Guest-" . $uniq;
$user = new ParseUser();
$user->set("username", $name);
$user->set("password", $uniq);
$user->setArray("connected", []);
$user->set("status", 0);
try {
$user->signUp();
$_SESSION['user'] = $user;
$_SESSION['notification'] = true;
$query = new ParseQuery("_Session");
$query->equalTo("user", $user);
$query->includeKey("user");
$query->descending("createdAt");
$query->limit(1);
$new = $query->find(true);
$_SESSION['last_date'] = date_format($new[0]->getCreatedAt(), 'Y-m-d\\TH:i:s.u\\Z');
add_user_report($_SESSION['id'], $user);
} catch (ParseException $ex) {
echo $ex;
示例2: ParseUser
return null;
}
if (!empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['fullname']) && !empty($_POST['phone']) && !empty($_POST['address'])) {
$user = new ParseUser();
$user->set("username", $_POST['email']);
$user->set("password", $_POST['password']);
$user->set("email", $_POST['email']);
$user->set("phone", $_POST['phone']);
$user->set("fullName", $_POST['fullname']);
$user->set("address", $_POST['address']);
$user->set("role", "user");
$user->set("approve", 0);
$ne = new ParseGeoPoint($_POST['NorthEastLat'], $_POST['NorthEastLng']);
$sw = new ParseGeoPoint($_POST['SouthWestLat'], $_POST['SouthWestLng']);
$location = [$ne, $sw];
$user->setArray("location", $location);
try {
$user->signUp();
header('Location: afterRegister.html');
} catch (ParseException $ex) {
// Show the error message somewhere and let the user try again.
//echo $ex->getMessage();
$status = '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>';
$status .= $ex->getMessage();
$status .= '</div>';
}
} else {
if (!empty($_POST['email'])) {
$status = '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>';
$status .= "Please complete form fields";
$status .= '</div>';
示例3: userSignUp
public function userSignUp($params)
{
// creat new ParseUser object
$user = new ParseUser();
// set params
foreach ($params as $name => $data) {
switch ($data['type']) {
case 'array':
$user->setArray($name, $data['value']);
break;
default:
$user->set($name, $data['value']);
break;
}
}
try {
$user->signUp();
return array('status' => '1', 'data' => $user);
} catch (ParseException $e) {
return array('status' => '0', 'data' => $e->getMessage());
}
}