Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assign Array Of Objects To Session

Tags:

php

I got the following:

$_SESSION["content"] = $contentList->Value;

Where it assigns an array of objects to the session variable... When I then try to access the array it return 60 elements for example that are the size of the array but the objects in the array are blank... None of the properties in them are set.

Try to access:

$contentList = $_SESSION["content"];
foreach($contentList as $currentContent)
{
    //......
}
like image 306
Lennie Avatar asked Dec 08 '25 09:12

Lennie


1 Answers

Make sure you have included the classe definition before invoking sesssion_start()

like image 102
julioc Avatar answered Dec 10 '25 00:12

julioc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!