Jump to content

Recommended Posts

You can do it with session, but you still have to "re-create" it in a sense.

 

I cannot remember excatly how it is done, but I think it is something similiar to this:

 

<?php
session_start();
include('classdefinition.php'); // this is required.

if (!isset($_SESSION['object'])) {
    $object = new class();
}else {
    $object = unserialize($_SESSION['object']);
} 



// this needs to be at the end of the processing.
$_SESSION['object'] = serialize($object);
?>

 

I am not 100% sure if that is the correct code. I think I am missing something, but that is the basic gist of it. If I do some research and find out if that is right I will let you know.

 

EDIT:

Alright I remembered what I was missing, the serialize and unserialize functions. The above should work now.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.