本文整理汇总了PHP中Parse\ParseUser::save方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseUser::save方法的具体用法?PHP ParseUser::save怎么用?PHP ParseUser::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseUser
的用法示例。
在下文中一共展示了ParseUser::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
function register($name, $email, $password, $teacher)
{
$user = new ParseUser();
$user->set("username", $email);
$user->set("email", $email);
$user->set("password", $password);
$user->set("name", $name);
if ($teacher == "true") {
$user->set("Teacher", true);
} else {
$user->set("Teacher", false);
}
try {
$user->signUp();
$user->save();
if ($teacher == "true") {
header("Location: profile.php");
} else {
header("Location: howToLearn.php");
}
// Hooray! Let them use the app now.
} catch (ParseException $ex) {
// Show the error message somewhere and let the user try again.
}
}
示例2: dtestUserUpdates
public function dtestUserUpdates()
{
$user = new ParseUser();
$user->setUsername('asdf');
$user->setPassword('zxcv');
$user->set('email', 'asdf@example.com');
$user->signUp();
$this->assertNotNull(ParseUser::getCurrentUser());
$user->setUsername('test');
$user->save();
$this->assertNotNull($user->get('username'));
$this->assertNotNull($user->get('email'));
$user->destroy();
$query = ParseUser::query();
$this->setExpectedException('Parse\\ParseException', 'Object not found');
$fail = $query->get($user->getObjectId());
}
示例3: signUpUser
function signUpUser($email, $password, $token, $phone = "301-828-8684")
{
$user = new ParseUser();
$user->set("username", $email);
$user->set("password", $password);
$user->set("email", $email);
$user->set("phone", $phone);
// Parse try-catch
try {
$user->signUp();
// Stripe try-catch
try {
$customer = \Stripe\Customer::create(array('email' => $email, 'card' => $token));
$user->set("stripeID", $customer->id);
$user->save();
} catch (\Stripe\Error\InvalidRequest $e) {
$user->destroy();
return $e->getMessage();
} catch (\Stripe\Error\Authentication $e) {
$user->destroy();
return $e->getMessage();
} catch (\Stripe\Error\ApiConnection $e) {
$user->destroy();
return $e->getMessage();
} catch (\Stripe\Error\Base $e) {
$user->destroy();
return $e->getMessage();
} catch (Exception $e) {
$user->destroy();
return $e->getMessage();
}
} catch (\Parse\ParseException $ex) {
return $ex->getMessage();
}
return "success";
}