Skip to content
This repository has been archived by the owner on Jan 4, 2020. It is now read-only.

Commit

Permalink
改进session函数对多维赋值的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Dec 18, 2014
1 parent 41f9b72 commit 7b01953
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions ThinkPHP/Common/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1288,14 +1288,20 @@ function session($name='',$value='') {
}
}
}else{ // 设置session
if($prefix){
if (!isset($_SESSION[$prefix])) {
$_SESSION[$prefix] = array();
}
$_SESSION[$prefix][$name] = $value;
}else{
$_SESSION[$name] = $value;
}
if(strpos($name,'.')){
list($name1,$name2) = explode('.',$name);
if($prefix){
$_SESSION[$prefix][$name1][$name2] = $value;
}else{
$_SESSION[$name1][$name2] = $value;
}
}else{
if($prefix){
$_SESSION[$prefix][$name] = $value;
}else{
$_SESSION[$name] = $value;
}
}
}
return null;
}
Expand Down

1 comment on commit 7b01953

@geekli
Copy link

@geekli geekli commented on 7b01953 Dec 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
期待这个功能很长时间了

Please sign in to comment.