当前位置: 首页>>代码示例>>PHP>>正文


PHP ParseUser::save方法代码示例

本文整理汇总了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.
    }
}
开发者ID:TiagoRechau,项目名称:E-learning-for-elderly,代码行数:25,代码来源:register.php

示例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());
 }
开发者ID:nidalb,项目名称:baas,代码行数:17,代码来源:ParseUserTest.php

示例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";
 }
开发者ID:es2fq,项目名称:BaasAPI,代码行数:36,代码来源:BaasAPI.php


注:本文中的Parse\ParseUser::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。