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


PHP R::findOrCreate方法代码示例

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


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

示例1: __construct

 function __construct($email = null)
 {
     $email = urldecode($email);
     // halt on error: wrong email format
     if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
         throw new Exception('JAC_User_WrongEmail: Format of the provided email address is not correct.');
         return;
     }
     // email address is valid - assign the value
     $this->email = $email;
     // load the user or create one if it does not exists (by email address)
     $this->dbPointer = R::findOrCreate('user', array('email' => $email));
     // assign the values from DB
     $this->name = $this->dbPointer->name;
     $this->id = $this->dbPointer->id;
 }
开发者ID:esamo,项目名称:WebFoundary_PHPDeveloperTest,代码行数:16,代码来源:class-user.php

示例2: markUserAsUnsynced

 /**
  * mark user as unsynced in cased user is updated
  * @param int $userId id of the user to be marked as unsynced
  * @return boolean
  * **/
 public function markUserAsUnsynced($userId)
 {
     $userRow = \R::findOrCreate($this->_name, array("users_id" => $userId));
     $userRow->ams_sync_status = 0;
     $userRow->amt_sync_status = 0;
     $userRow->dmb_sync_status = 0;
     try {
         $this->_redBeans->store($userRow);
         //         //lets send ipn to all clients
         //         $objIpnHandler = new ipn\IpnHandler();
         //         $objIpnHandler->sendIpnForUpdatedUser($userId);
         return true;
     } catch (\Exception $ex) {
         return false;
     }
     return false;
 }
开发者ID:samiksha-singla,项目名称:Api-Framework,代码行数:22,代码来源:UserSyncStatus.php

示例3: trim

            if (in_array($img_base64, $null_image) !== FALSE) {
                $img_base64 = NULL;
            }
        }
        $available_td_list = $qp->find('.bibItemsEntry td:contains("可流通")');
        for ($i = 0; $i < $available_td_list->size(); $i++) {
            $call_number = $available_td_list->eq($i)->prev()->text();
            $call_number = trim($call_number);
            $location = $available_td_list->eq($i)->prev()->prev()->text();
            $location = trim($location);
            $data[] = array("title" => $title, "call_number" => $call_number, "location" => $location, "isbn" => $isbn, "img" => $img_base64);
        }
        //    $data = array(
        //        "error" => "NOT_FOUND"
        //    );
    }
}
// if (htmlqp($url, '.bibItemsEntry td:contains("可流通")')->size() > 0) {
// ---------------------------
// 轉換
$json = json_encode($data, JSON_UNESCAPED_UNICODE);
//$json = json_encode($data);
// ---------------------------
// 備份快取資料
$result = R::findOrCreate('cache_query_result', ['isbn' => $isbn]);
$result->isbn = $isbn;
$result->json = $json;
$result->timestamp = time();
R::store($result);
echo $json;
book_list_log($json);
开发者ID:pulipulichen,项目名称:nccu-book-cart-server,代码行数:31,代码来源:index.php


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