开发者

Storing links in a session?

开发者 https://www.devze.com 2023-04-08 20:06 出处:网络
I want to store links in a session or multiple sessions and I was wondering what would be the best way to do this..

I want to store links in a session or multiple sessions and I was wondering what would be the best way to do this..

I 开发者_开发百科was thinking that I could use a for loop with sessions foreach session as $s .... But then I would need $session1, $session2, $session3, etc.

Thanks in advance,

--I'm a PHP noob.


You can store arrays in sessions:

$_SESSION['links'] = array('example.com', 'example2.com');

foreach ($_SESSION['links'] as $link) {
  // Do something with $link
}
0

精彩评论

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

关注公众号