也许做这样的事情
原文链接:/php/138904.htmlforeach($_SESSION as $key => $val) { if ($key !== 'somekey') { unset($_SESSION[$key]); } }
foreach($_SESSION as $key => $val) { if ($key !== 'somekey') { unset($_SESSION[$key]); } }