开发者

Check multiple $_SESSION are empty

I have multiple $_SESSION variables with different names (e.g $_SESSION['blue'], _SESSION['pu开发者_运维问答rple'], _SESSION['cream'] etc... is there any way I can use a loop to check which ones are empty and therefore ignore?


foreach ($_SESSION as $key => $value) { 
    if (empty($value)) {
         // ignore 
    }
}


You could use foreach loop

foreach ($_SESSION as $key => $value)
{
  // This goes through the keys that exist.
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜