本文整理汇总了PHP中Parse\ParseUser::getObjectId方法的典型用法代码示例。如果您正苦于以下问题:PHP ParseUser::getObjectId方法的具体用法?PHP ParseUser::getObjectId怎么用?PHP ParseUser::getObjectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse\ParseUser
的用法示例。
在下文中一共展示了ParseUser::getObjectId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ParseUser
$user = new ParseUser();
$user->set("username", $email);
$user->set("password", $pass);
$user->set("email", $email);
$user->set("corporate", true);
$user->set("name", $company_name);
$user->set("logo", $file);
$user->set("logo_url", $file->getURL());
unlink($target_dir . $name);
// try signup
try {
$user->signUp();
// Hooray! Let them use the app now.
$_SESSION['login'] = "1";
$_SESSION['email'] = $email;
$_SESSION['userid'] = $user->getObjectId();
header("Location: index.php");
} catch (ParseException $ex) {
// Show the error message somewhere and let the user try again.
echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
}
}
}
echo include "assets/templates/header.php";
?>
<br>
<br>
<div id="login-overlay" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
示例2: dtestUserLoadedFromStorageFromLogIn
public function dtestUserLoadedFromStorageFromLogIn()
{
ParseTestHelper::clearClass(ParseUser::$parseClassName);
$fosco = new ParseUser();
$fosco->setUsername('fosco');
$fosco->setPassword('password');
$fosco->signUp();
$id = $fosco->getObjectId();
$this->assertNotNull($id);
ParseUser::logOut();
ParseUser::_clearCurrentUserVariable();
$current = ParseUser::getCurrentUser();
$this->assertNull($current);
ParseUser::logIn("fosco", "password");
$current = ParseUser::getCurrentUser();
$this->assertEquals($id, $current->getObjectId());
ParseUser::_clearCurrentUserVariable();
$current = ParseUser::getCurrentUser();
$this->assertEquals($id, $current->getObjectId());
}
示例3: getUserWriteAccess
/**
* Get whether the given user is *explicitly* allowed to write this object.
* Even if this returns false, the user may still be able to access it if
* getPublicWriteAccess returns true or a role that the user belongs to has
* write access.
*
* @param ParseUser $user
*
* @throws \Exception
*
* @return bool
*/
public function getUserWriteAccess($user)
{
if (!$user->getObjectId()) {
throw new Exception('cannot getWriteAccess for a user with null id');
}
return $this->getWriteAccess($user->getObjectId());
}