RE: OO website/program doubt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






On Wed, November 1, 2006 3:30 pm, bruce wrote:
> yo rich (or others)...
>
> does php provide the ability to store objects in a session var????

As I just said (below, thanks to top-posting).

Yes, I think so.

You just need to be sure the require for the class definition happens
*BEFORE* the objects are instantiated, as I understand it.

/* Right Way */
require 'class_definitions_needed_for_objects_in_session_vars.class';
session_start();


At least, that's my interpretation of the posts I've seen from people
who actually use PHP OOP and cram objects into sessions. [shudder]

Resources (e.g., MySQL connections) are released at the end of a
script, and will not be resurrectable, at least not in PHP 4 & 5 as I
understand it.

> -----Original Message-----
> From: Richard Lynch [mailto:ceo@xxxxxxxxx]
> Sent: Wednesday, November 01, 2006 1:16 PM
> To: Meghdad Azriel
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  OO website/program doubt
>
>
> On Wed, November 1, 2006 2:50 pm, Meghdad Azriel wrote:
>> The objects in an OO website/program is always alive in the session,
>> or they
>> die at  the end of the execution of each page?
>
> They die and are resurrected like zombies on the next page.
>
> The Resurrection is slightly more complicated than that described in
> the Bible, however, requiring some serious gnarly timing issues in
> your loading of the class definitions before you attempt to use the
> objects...
>
> Probably best to load all your class definitions before you do
> session_start() from that perspective, though I don't know as I never
> use OOP much in PHP.
>
> You *could* write a daemon in PHP to have long-lived objects, however,
> if you want to keep them around for a long shelf life.
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux