You are here: Re: -> PHP4 Singleton implementation question <- « PHP Programming Language « IT news, forums, messages
Re: -> PHP4 Singleton implementation question <-

Posted by Jerry Stuckle on 11/30/06 16:13

Steve JORDI wrote:
>>Following the PHP documentation on http://nl3.php.net/static , I would
>>suggest to replace this last line with a non-referencing one:
>>$welcome = Welcome::getInstance() ;
>
>
> Did this but it din't change a thing.
>
>
>>As was posted earlier, PHP5 has solved the objects-and-references problem.
>
>
> Yes, but I have to deal with PHP4, not 5 unfortunately.
>
> I also tried to set a $_SESSION['welcome'] variable, but still, each
> time I reenter my page, it's reassigned a new instance.
>
> It's crazy, I would never have thought that it would be such a hassle
> to keep a variable value between pages (without using URL parameters).
>
> Thanks anyway.
>
> Sincerely,
> Steve JORDI
>
> (Remove the K_I_L_LSPAM from my email address)
> ------------------------------------------------
> 1197 Prangins Email: stevejordiK_I_L_LSPAM@hotmail.com
> Switzerland WWW: www.sjordi.com
> ------------------------------------------------
> Volcanoes at www.sjordi.com/volcanoes
> MovieDB at www.sjmoviedb.com
> ------------------------------------------------

Steve,

If you've ever done any transactional processing, that's what web pages are.

When the browser makes a request, the server starts a process (or
thread) to handle the request. It allocates the necessary resources,
and turns control over to your program (the php interpreter, in this
case). The interpreter allocates additional resources as necessary to
process your script and runs the script.

When the script ends, the process reverses. The interpreter cleans up
its resources and returns to the server. The server then cleans up the
resources it allocated and terminates the process or thread.

Each request is separate in itself. Resources are not kept, because
another request may or may not follow this one. And if another request
does come in, it may or may not be something you expect. And it may or
may not be from the same user.

Now, the developers understood there was a need to save information
across requests. Therefore they implemented sessions to save the data
on the server, and cookies to save it on the browser.

So, if you want to save your object across the request, you need to
store it in the session (not a good idea to store this in the cookie -
too many people have cookies disabled, and saving them on the user's
computer allows the user to edit the cookie).


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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