Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP share objects across multiple sessions

Tags:

oop

php

singleton

How can I have user A and user B has the same instance of an object? I guess this would be across two different sessions.

like image 375
Jeremiah Avatar asked Aug 30 '26 06:08

Jeremiah


1 Answers

Checkout APC,

http://www.php.net/manual/en/intro.apc.php

You can store the object to cache like this,

apc_store('my_key', $obj);

and retrieve from another page/session, like this,

$obj = apc_fetch('my_key');
like image 90
ZZ Coder Avatar answered Sep 01 '26 19:09

ZZ Coder