TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Passing classes among PHP pages (http://www.talkphp.com/absolute-beginners/5585-passing-classes-among-php-pages.html)

thepriebe 09-27-2010 04:08 PM

Passing classes among PHP pages
 
Hello,

I'm trying to make a website using OOP with classes. Aside from passing a class using the $_GET and $_POST, how do I use an instance of a class on more than the in which the class is instantiated?

For instance, I have a class in organization.php, I create an instance of it in class.php, but I want to use variables set in class.php in test.php.

Suggestions?

tony 09-27-2010 06:14 PM

you could make it a singleton class or serialize it in class.php and save it in a file and then in test.php retrieve the file contents and unserialize it. But some class serialization sometimes dont keep the content of properties of a class if the property value is an instance, resource, or reference.


All times are GMT. The time now is 05:43 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0