Home  >  Article  >  Backend Development  >  怎么只删除session中某个元素

怎么只删除session中某个元素

WBOY
WBOYOriginal
2016-06-13 10:07:581027browse

如何只删除session中某个元素?
例如有:
session(0=>array(0=>'aa',1=>'bb'),1=>array(0=>'cc',1=>'dd'))
现在需要只删除aa,能否实现?

用unset不行,会把整个session destory掉

------解决方案--------------------
unset(session['username'])
------解决方案--------------------
session_start();
unset($_SESSION[0][0]);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn