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


PHP UUID::v4方法代码示例

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


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

示例1: tweet_post

function tweet_post()
{
    $args = func_get_args();
    $cate = $args[2];
    $content = format_str($_POST['text'], false);
    if (!$cate or !$content) {
        die("Invalid argument!");
    }
    include_once 'sinaoauth.inc.php';
    $c = new WeiboClient(SINA_AKEY, SINA_SKEY, $GLOBALS['user']['sinakey']['oauth_token'], $GLOBALS['user']['sinakey']['oauth_token_secret']);
    if ($_FILES['upload']['tmp_name']) {
        $msg = $c->upload($content, $_FILES['upload']['tmp_name']);
    } else {
        $msg = $c->update($content);
    }
    if ($msg === false || $msg === null) {
        echo "Error occured";
        return false;
    }
    if (isset($msg['error_code']) && isset($msg['error'])) {
        echo 'Error_code: ' . $msg['error_code'] . ';  Error: ' . $msg['error'];
        return false;
    }
    include_once "uuid.inc.php";
    $v4uuid = str_replace("-", "", UUID::v4());
    connect_db();
    $add = "INSERT INTO pending_tweets (\r\n                     site_id, tweet_id, user_site_id, content, post_datetime,\r\n                     type, tweet_site_id,\r\n                     post_screenname, profile_image_url, source)\r\n                     VALUES (1, '{$v4uuid}', '" . $msg['user']['id'] . "', '{$content}', '" . date("Y-m-d H:i:s", strtotime($msg["created_at"])) . "',\r\n                     {$cate}, '" . $msg['id'] . "', '" . $msg["user"]["name"] . "', '" . $msg["user"]["profile_image_url"] . "', '" . $msg["source"] . "')";
    if ($msg['thumbnail_pic']) {
        $add = "INSERT INTO pending_tweets (\r\n                     site_id, tweet_id, user_site_id, content, post_datetime,\r\n                     type, tweet_site_id,\r\n                     post_screenname, profile_image_url, source, thumbnail)\r\n                     VALUES (1, '{$v4uuid}', '" . $msg['user']['id'] . "', '{$content}', '" . date("Y-m-d H:i:s", strtotime($msg["created_at"])) . "',\r\n                     {$cate}, '" . $msg['id'] . "', '" . $msg["user"]["name"] . "', '" . $msg["user"]["profile_image_url"] . "', '" . $msg["source"] . "', '" . $msg['thumbnail_pic'] . "')";
    }
    $added = mysql_query($add) or die("Could not add entry!");
    echo "0";
}
开发者ID:soross,项目名称:0f523140-f3b3-4653-89b0-eb08c39940ad,代码行数:33,代码来源:tweet.inc.php

示例2: assignCredentials

 /**
  * Update the sign-in credentials for the specific user.
  *
  * @param UserRecord $user The user to update the credentials for
  * @return Boolean True on success
  */
 public function assignCredentials(UserRecord $user)
 {
     $db = new DatabaseConnection();
     // Generate a new salt and hash the password
     $salt = $this->generateSalt();
     // What hashing algorithm to use
     $ha = config::get('lepton.user.hashalgorithm', 'md5');
     $ps = $user->password . $salt;
     $hp = hash($ha, $ps);
     if ($user->userid == null) {
         $uuid = UUID::v4();
         try {
             $id = $db->insertRow("REPLACE INTO " . LEPTON_DB_PREFIX . "users (username,salt,password,email,flags,registered,uuid) VALUES (%s,%s,%s,%s,%s,NOW(),%s)", $user->username, $salt, $hp, $user->email, $user->flags, $uuid);
             $user->userid = $id;
         } catch (Exception $e) {
             throw $e;
             // TODO: Handle exception
         }
     } else {
         try {
             $db->updateRow("UPDATE " . LEPTON_DB_PREFIX . "users SET username=%s,salt=%s,password=%s,email=%s,flags=%s WHERE id=%d", $user->username, $salt, $hp, $user->email, $user->flags, $user->userid);
         } catch (Exception $e) {
             throw $e;
             // TODO: Handle exception
         }
     }
     return true;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:34,代码来源:defaultauthbackend.php

示例3: indexAction

 public function indexAction()
 {
     if ($this->request->isPost()) {
         $register = new Users();
         $register->id = UUID::v4();
         $register->password = $this->security->hash($this->request->getPost('password'));
         $register->phonenumber = $this->request->getPost('phonenumber');
         $register->email = $this->request->getPost('email');
         $register->name = $this->request->getPost('name');
         $register->created_date = Carbon::now()->now()->toDateTimeString();
         $register->updated_date = Carbon::now()->now()->toDateTimeString();
         $user = Users::findFirstByEmail($register->email);
         if ($user) {
             $this->flash->error("can not register, User " . $register->email . " Alredy Registerd! ");
             return true;
         }
         if ($register->save() === true) {
             $this->session->set('user_name', $register->name);
             $this->session->set('user_email', $register->email);
             $this->session->set('user_id', $register->id);
             $this->flash->success("Your " . $register->email . " has been registered Please Login for booking court");
             $this->response->redirect('dashboard');
         }
     }
 }
开发者ID:limferdi,项目名称:soccerStadiumReservation,代码行数:25,代码来源:RegisterController.php

示例4: doBaseTasks

 /**
  * Do general tasks used application whide
  */
 protected function doBaseTasks()
 {
     $this->showTestHeadline("Checking application base structure");
     if (HSetting::Get('secret') == "" || HSetting::Get('secret') == null) {
         HSetting::Set('secret', UUID::v4());
         $this->showFix('Setting missing application secret!');
     }
 }
开发者ID:skapl,项目名称:design,代码行数:11,代码来源:IntegrityChecker.php

示例5: Write

 function Write($head, $message)
 {
     self::DeleteOld();
     $guid = UUID::v4();
     $date = date("Y-m-d H:i:s");
     $user = Session::GetUserId($this->session);
     $this->db->Exec("INSERT INTO `Logs`(`id`,`UserId`,`DateTime`,`Head`,`Message`)\n          VALUE ('{$guid}','{$user}','{$date}','{$head}','{$message}'); ");
 }
开发者ID:greshniksv,项目名称:Medic,代码行数:8,代码来源:logging.php

示例6: beforeSave

 /**
  * Before Save Addons
  *
  * @return type
  */
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         // Create GUID for new files
         $this->guid = UUID::v4();
     }
     return parent::beforeSave();
 }
开发者ID:ahdail,项目名称:humhub,代码行数:13,代码来源:File.php

示例7: beforeValidate

 public function beforeValidate($event)
 {
     if ($this->getOwner()->isNewRecord) {
         if ($this->getOwner()->guid == "") {
             $this->getOwner()->guid = UUID::v4();
         }
     }
     return parent::beforeValidate($event);
 }
开发者ID:alefernie,项目名称:intranet,代码行数:9,代码来源:HGuidBehavior.php

示例8: create

 public static function create($type, $name)
 {
     //get or create namespace uuid for Group-Office
     $namespace = \GO::config()->get_setting('uuid_namespace');
     if (!$namespace) {
         $namespace = UUID::v4();
         \GO::config()->save_setting('uuid_namespace', $namespace);
     }
     return UUID::v5($namespace, $type . $name);
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:10,代码来源:UUID.php

示例9: GenId

 public static function GenId($userid)
 {
     global $db;
     $guid = UUID::v4();
     $date = date("Y-m-d H:i:s");
     $dateExt = new DateTime();
     $dateExt->modify('+15 minutes');
     $def = $dateExt->format("Y-m-d H:i:s");
     $db->Exec("INSERT INTO `Session`(`id`,`UserId`,`CreateDate`,`ExpireDate`)\n                      VALUE ('{$guid}','{$userid}','{$date}','{$def}'); ");
     return $guid;
 }
开发者ID:greshniksv,项目名称:Medic,代码行数:11,代码来源:Session.php

示例10: insertHeadInRequest

 public function insertHeadInRequest()
 {
     $prefix = $this->doc->documentElement->prefix;
     $dateTime = date('d.m.Y') . 'T' . date('H:i:s');
     $header = new DOMElement("{$prefix}:Zaglavlje", '', $this->doc->documentElement->namespaceURI);
     $reqDateTime = new DOMElement("{$prefix}:DatumVrijeme", $dateTime, $this->doc->documentElement->namespaceURI);
     $reqUUID = new DOMElement("{$prefix}:IdPoruke", UUID::v4(), $this->doc->documentElement->namespaceURI);
     $refElem = $this->doc->documentElement->firstChild;
     $this->doc->documentElement->insertBefore($header, $refElem);
     $header->appendChild($reqUUID);
     $header->appendChild($reqDateTime);
 }
开发者ID:sokac237,项目名称:fiskalizacija-php,代码行数:12,代码来源:FiskalRequestXML.php

示例11: createUid

 public function createUid($app_id, $device_id)
 {
     $uuid = new DreamDeviceUuid();
     $uuid->app_id = $app_id;
     $uuid->uuid = UUID::v4();
     $uuid->device_id = $device_id;
     $uuid->setIsNewRecord(true);
     if ($uuid->save(false)) {
         return $uuid->id;
     }
     return false;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:12,代码来源:DreamDeviceUuid.php

示例12: register

 public function register()
 {
     // デバイストークンとプラットフォームを取得
     $deviceToken = $this->request->data('device_token');
     $platform = $this->request->data('platform');
     // UUIDを第4生成アルゴリズムで生成する
     $uuid = UUID::v4();
     $data = array('uuid' => $uuid, 'device_token' => $deviceToken ? $deviceToken : null, 'platform' => $platform);
     if ($this->User->save($data)) {
         return $this->succeed(array('uuid' => $uuid));
     } else {
         return $this->validationError('User', $this->User->validationErrors);
     }
 }
开发者ID:hashimotoryoh,项目名称:Kinopy_SERVER,代码行数:14,代码来源:UsersController.php

示例13: StartLog

 public static function StartLog(\Puzzlout\Framework\Core\Application $app, $source, $type = null)
 {
     if (is_null($source)) {
         throw new \Exception("Log must have a source, e.g. __CLASSNAME__.__METHOD__", 0, null);
         //todo: create the error code.
     }
     $log = new \Puzzlout\Framework\BO\F_log();
     $log->setF_log_guid(UUID::v4());
     $log->setF_log_level($type);
     $log->setF_log_request_id($app->request()->requestId());
     $log->setF_log_start(Logger::GetTime());
     $log->setF_log_source($source);
     self::SetLog($app->user(), $log);
     return $log->F_log_guid();
 }
开发者ID:Puzzlout,项目名称:FrameworkMvcLegacy,代码行数:15,代码来源:TimeLogger.php

示例14: recoverPassword

 /**
  * Sends this user a new password by E-Mail
  *
  */
 public function recoverPassword()
 {
     $user = User::model()->findByAttributes(array('email' => $this->email));
     // Switch to users language - if specified
     if ($user->language !== "") {
         Yii::app()->language = $user->language;
     }
     $token = UUID::v4();
     $user->setSetting('passwordRecoveryToken', $token . '.' . time(), 'user');
     $message = new HMailMessage();
     $message->view = "application.modules_core.user.views.mails.RecoverPassword";
     $message->addFrom(HSetting::Get('systemEmailAddress', 'mailing'), HSetting::Get('systemEmailName', 'mailing'));
     $message->addTo($this->email);
     $message->subject = Yii::t('UserModule.forms_AccountRecoverPasswordForm', 'Password Recovery');
     $message->setBody(array('user' => $user, 'linkPasswordReset' => Yii::app()->createAbsoluteUrl("//user/auth/resetPassword", array('token' => $token, 'guid' => $user->guid))), 'text/html');
     Yii::app()->mail->send($message);
 }
开发者ID:alefernie,项目名称:intranet,代码行数:21,代码来源:AccountRecoverPasswordForm.php

示例15: checkoutAction

 public function checkoutAction()
 {
     $id = $this->session->get('user_id');
     $orderList = TempOrder::find("user_id = '{$this->session->get('user_id')}'");
     foreach ($orderList as $key => $value) {
         $order = new Orders();
         $order->id = UUID::v4();
         $order->stadium = $value->stadium;
         $order->start_hour = $value->start_hour;
         $order->end_hour = $value->end_hour;
         $order->user_id = $value->user_id;
         $order->date_created = Carbon::now()->toDateString();
         $order->save();
         $value->delete();
     }
     $this->response->redirect('/dashboard');
 }
开发者ID:limferdi,项目名称:soccerStadiumReservation,代码行数:17,代码来源:ProcessController.php


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