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


PHP person::exists方法代码示例

本文整理汇总了PHP中person::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP person::exists方法的具体用法?PHP person::exists怎么用?PHP person::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在person的用法示例。


在下文中一共展示了person::exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getOAuthToken

 /**
  * Get or create a token for this person_id for this app
  * @return  array
  */
 public function getOAuthToken()
 {
     $person_id = $this->person_id();
     if (!$person_id) {
         static::error('User not specified.');
     }
     if (!\person::exists($person_id)) {
         static::error('Invalid user.');
     }
     $clause = array('person_id' => $person_id);
     if (!$this->app_key()) {
         $app_id = null;
     } else {
         $api_app = static::getApiAppByKey($this->app_key());
         if (!$api_app) {
             static::error('Invalid app_key.');
         }
         $app_id = $api_app->getID();
     }
     $clause[static::getApiAppModelName() . '_id'] = $app_id;
     if (!$clause) {
         static::error('Unknown Identity.');
     }
     $m = static::getOauthModelName();
     $oauth = $m::getOne($clause);
     if (!$oauth || !$oauth->token) {
         $oauth = $m::insert($clause);
     }
     return array('oauth_token' => $oauth->token, 'issued' => $oauth->getTimeIssued(), 'now' => strtotime(\aql::now()), 'expires' => $oauth->getTimeExpires());
 }
开发者ID:HotwireCommunications,项目名称:skyphp,代码行数:34,代码来源:Identity.php

示例2: save

 function save()
 {
     // Error-checking should already be complete
     if (person::exists($this->id)) {
         // UPDATE an existing database entry
         $query = "UPDATE people set " . "firstname = " . $this->firstname . ", " . "lastname = " . $this->lastname . ", " . "address_home_street_1 = " . $this->address_home_street_1 . ", " . "address_home_street_2 = " . $this->address_home_street_2 . ", " . "address_home_city = " . $this->address_home_city . ", " . "address_home_state = " . $this->address_home_state . ", " . "address_home_zip = " . $this->address_home_zip . ", " . "address_work_street_1 = " . $this->address_work_street_1 . ", " . "address_work_street_2 = " . $this->address_work_street_2 . ", " . "address_work_city = " . $this->address_work_city . ", " . "address_work_state = " . $this->address_work_state . ", " . "address_work_zip = " . $this->address_work_zip . ", " . "email = " . $this->email . ", " . "phone_personal_cell = " . $this->phone_personal_cell . ", " . "phone_work = " . $this->phone_work . ", " . "phone_work_cell = " . $this->phone_work_cell . ", " . "phone_home = " . $this->phone_home . ", " . "fax = " . $this->fax . ", " . "gender = " . $this->gender . ", " . "birthdate = " . $this->birthdate . ", " . "facebook_username = " . $this->facebook_username . ", " . "username = " . $this->username . ", " . "headshot_filename = " . $this->headshot_filename . " WHERE id = " . $this->id;
         $result = mydb::cxn()->query($query);
         if (mydb::cxn()->error != '') {
             throw new Exception('There was a problem updating ' . $this->firstname . ' ' . $this->lastname . '\'s database entry.');
         }
     } else {
         // INSERT a new database entry
         $query = "INSERT INTO people (" . "firstname, " . "lastname, " . "address_home_street_1, " . "address_home_street_2, " . "address_home_city, " . "address_home_state, " . "address_home_zip, " . "address_work_street_1, " . "address_work_street_2, " . "address_work_city, " . "address_work_state, " . "address_work_zip, " . "email, " . "phone_personal_cell, " . "phone_home, " . "phone_work, " . "phone_work_cell, " . "fax, " . "gender, " . "birthdate, " . "facebook_username, " . "username, " . "headshot_filename) " . "VALUES (" . "'" . $this->firstname . "', " . "'" . $this->lastname . "', " . "'" . $this->address_home_ . "', " . "'" . $this->address_home_ . "', " . "'" . $this->address_home_ . "', " . "'" . $this->address_home_ . "', " . "'" . $this->address_home_ . "', " . "'" . $this->address_work_ . "', " . "'" . $this->address_work_ . "', " . "'" . $this->address_work_ . "', " . "'" . $this->address_work_ . "', " . "'" . $this->address_work_ . "', " . "'" . $this->email . "', " . "'" . $this->phone_personal_cell . "', " . "'" . $this->phone_home . "', " . "'" . $this->phone_work . "', " . "'" . $this->phone_work_cell . "', " . "'" . $this->fax . "', " . "'" . $this->gender . "', " . "'" . $this->birthdate->format('Y-m-d') . "', " . "'" . $this->facebook_username . "', " . "'" . $this->username . "', " . "'" . $this->headshot_filename . "')";
         $result = mydb::cxn()->query($query);
         if (mydb::cxn()->error != '') {
             throw new Exception('There was a problem inserting ' . $this->firstname . ' ' . $this->lastname . '\'s database entry.');
         }
     }
 }
开发者ID:evanhsu,项目名称:siskiyourappellers,代码行数:19,代码来源:person_class.php


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