當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Session::regenerateID方法代碼示例

本文整理匯總了PHP中yii\web\Session::regenerateID方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::regenerateID方法的具體用法?PHP Session::regenerateID怎麽用?PHP Session::regenerateID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\web\Session的用法示例。


在下文中一共展示了Session::regenerateID方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: regenerateID

 /**
  * Updates the current session ID with a newly generated one .
  * Please refer to <http://php.net/session_regenerate_id> for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  */
 public function regenerateID($deleteOldSession = false)
 {
     if ($this->dbSession) {
         return $this->dbSession->regenerateID($deleteOldSession);
     } else {
         parent::regenerateID($deleteOldSession);
     }
 }
開發者ID:Liv1020,項目名稱:cms,代碼行數:13,代碼來源:Session.php

示例2: regenerateID

 /**
  * Updates the current session ID with a newly generated one.
  * Please refer to <http://php.net/session_regenerate_id> for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  */
 public function regenerateID($deleteOldSession = false)
 {
     $oldID = session_id();
     // if no session is started, there is nothing to regenerate
     if (empty($oldID)) {
         return;
     }
     parent::regenerateID(false);
     $newID = session_id();
     $collection = $this->db->getCollection($this->sessionCollection);
     $row = $collection->findOne(['id' => $oldID]);
     if ($row !== null) {
         if ($deleteOldSession) {
             $collection->update(['id' => $oldID], ['id' => $newID]);
         } else {
             unset($row['_id']);
             $row['id'] = $newID;
             $collection->insert($row);
         }
     } else {
         // shouldn't reach here normally
         $collection->insert(['id' => $newID, 'expire' => time() + $this->getTimeout()]);
     }
 }
開發者ID:lawguangwei,項目名稱:webDB,代碼行數:29,代碼來源:Session.php

示例3: regenerateID

 /**
  * Updates the current session ID with a newly generated one .
  * Please refer to <http://php.net/session_regenerate_id> for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  */
 public function regenerateID($deleteOldSession = false)
 {
     $oldID = session_id();
     // if no session is started, there is nothing to regenerate
     if (empty($oldID)) {
         return;
     }
     parent::regenerateID(false);
     $newID = session_id();
     $query = new Query();
     $row = $query->from($this->sessionTable)->where(['id' => $oldID])->createCommand($this->db)->queryOne();
     if ($row !== false) {
         if ($deleteOldSession) {
             $this->db->createCommand()->update($this->sessionTable, ['id' => $newID], ['id' => $oldID])->execute();
         } else {
             $row['id'] = $newID;
             $this->db->createCommand()->insert($this->sessionTable, $row)->execute();
         }
     } else {
         // shouldn't reach here normally
         $this->db->createCommand()->insert($this->sessionTable, ['id' => $newID, 'expire' => time() + $this->getTimeout()])->execute();
     }
 }
開發者ID:albertinho88,項目名稱:jlweb,代碼行數:28,代碼來源:DbSession.php

示例4: regenerateID

 /**
  * Updates the current session id with a newly generated one.
  * Please refer to {@link http://php.net/session_regenerate_id} for more details.
  * @param boolean $deleteOldSession Whether to delete the old associated session file or not.
  * @since 1.1.8
  */
 public function regenerateID($deleteOldSession = false)
 {
     $oldId = session_id();
     parent::regenerateID(false);
     $newId = session_id();
     $row = $this->getData($oldId);
     if (!is_null($row)) {
         if ($deleteOldSession) {
             // Delete + Put = Update
             $this->dynamoDb->deleteItem(array('TableName' => $this->tableName, 'Key' => array('id' => array('S' => (string) $oldId))));
             $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($this->idColumn => array('S' => (string) $newId), $this->dataColumn => $row[$this->dataColumn], $this->expireColumn => $row[$this->expireColumn])));
         } else {
             $row[$this->idColumn] = array('S' => (string) $newId);
             $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($row)));
         }
     } else {
         $this->dynamoDb->putItem(array('TableName' => $this->tableName, 'Item' => array($this->idColumn => array('S' => $newId), $this->expireColumn => array('N' => $this->getExpireTime()))));
     }
 }
開發者ID:pythagor,項目名稱:yii2-dynamodbsession,代碼行數:25,代碼來源:DynamoDbSession.php


注:本文中的yii\web\Session::regenerateID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。