User Tools

Site Tools


libraries:cookiehandler:cookiehandlerclass:readobjectcontent

CookieHandler::ReadObjectContent()


Definition

Returns the content of the cookie as usable PHP object/variable.
The content should be written with method WriteObjectContent() beforehand!

Mixed ReadObjectContent ()

Returns

  • Mixed
    Content of the cookie as deserialized PHP object/variable of a string.

Exception

  • CookieHandlerException:EC_READERROR (104)
    The cookie's content couldn't be read, converted or cookie doesn't exist

Example

class User
{
   public $Name = '';
   public $Age  = 0;
}
 
$NewUser = new User ();
$NewUser->Name = "Mr. Smith";
$NewUser->Age  = 20;
 
$NewUser2 = null;
 
$Cookie = new CookieHandler ("Testcookie");
 
try 
{
   $NewUser2 = $Cookie->ReadObjectContent ();
}
catch (CookieHandlerException $e)
{
   // [...]
}
libraries/cookiehandler/cookiehandlerclass/readobjectcontent.txt · Last modified: 2022/12/13 16:22 by michael.pohl