开发者

$_SESSION in PHP

开发者 https://www.devze.com 2023-01-26 16:39 出处:网络
I\'m trying to achieve something like $_SESSION[$key] 开发者_StackOverflowwithout the need of foreach loop, how can I achieve this? Please let me know

I'm trying to achieve something like $_SESSION[$key] 开发者_StackOverflowwithout the need of foreach loop, how can I achieve this? Please let me know

Thanks


array_merge will do more or less what you want assuming id is never numeric and you want to put everything in $_POST into $_SESSION, which may not be a good idea

$_SESSION=array_merge($_SESSION,$_POST);


the problem is sorted, I had to include single quotes in $_SESSION's index in order to make it treat like a non-numeric index.

Thanks for the help guys!

0

精彩评论

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