-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/34' into 'release/2.3'
Fix/34 重写当前会话活动功能 #34 See merge request imunc/iplacard!104
- Loading branch information
Showing
2 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
|
||
/** | ||
* Session辅助函数 | ||
* @author Kaijia Feng <[email protected]> | ||
* @copyright 2019 Kaijia Feng | ||
* @license Dual-licensed proprietary | ||
* @link http://iplacard.com/ | ||
* @package iPlacard | ||
* @since 2.3 | ||
*/ | ||
|
||
/** | ||
* 解析CodeIgniter序列化Session为数组 | ||
* @link https://www.php.net/manual/en/function.session-decode.php#108037 | ||
* @author Frits van Campen <[email protected]> | ||
* @param string $session 序列化Session字符串 | ||
* @return array Session数组 | ||
*/ | ||
function session_unserialize($session) | ||
{ | ||
$return = array(); | ||
$offset = 0; | ||
while($offset < strlen($session)) | ||
{ | ||
$pos = strpos($session, '|', $offset); | ||
$num = $pos - $offset; | ||
$varname = substr($session, $offset, $num); | ||
$offset += $num + 1; | ||
$data = unserialize(substr($session, $offset)); | ||
$return[$varname] = $data; | ||
$offset += strlen(serialize($data)); | ||
} | ||
return $return; | ||
} | ||
|
||
/* End of file session_helper.php */ | ||
/* Location: ./application/helpers/session_helper.php */ |