You are here: Re: Object classes « PHP Programming Language « IT news, forums, messages
Re: Object classes

Posted by Justin Koivisto on 10/20/05 16:39

Andy Jeffries wrote:
> Justin Koivisto wrote:
>
>> I think you answered your own question with this post... Use sessions.
>> You can serialize your object and store it in a session variable. Then
>> on the next script, make sure you include all the necessary include
>> files for the object classes before you unserialize. I'd personally
>> use sessions with custom handlers to utilize database tables for this,
>> but sometimes that is overkill and takes more resources.
>
>
> Just for reference (at least with PHP 4.3+) you don't need to
> explicitely serialize/unserialize your objects for use in Sessions. You
> can just do:
>
> require_once("foo.class.php");
> session_start();
> if (!is_object($_SESSION["myfoo"])) {
> $_SESSION["myfoo"] = new Foo();
> }
>
> $_SESSION["myfoo"]->bar();

You would not believe the number of ISPs still running the 4.0 and 4.1
branches... However, it is good to point that out for those who have
access to newer versions. I had that in my message, but deleted it as
not to confuse the point.

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация