当前位置: 首页>>代码示例>>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;未经允许,请勿转载。