Reply to Re: running scripts without session

Your name:

Reply:


Posted by ZeldorBlat on 06/17/07 15:31

On Jun 17, 3:41 am, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:
> "zono" <gonau...@gmail.com> wrote in message
>
> news:1182064637.077781.99180@c77g2000hse.googlegroups.com...
>
>
>
>
>
> > Jon Slaughter :
> >> When I run my scripts on a http server I can use the
> >> $_SESSION['Document_Root'] to get the dir of the scripts and stuff(I have
> >> my
> >> local file system laid out exactly as the one on my server.
>
> >> The issue is that when I run the script without using session_start I
> >> have
> >> to set the document root manually. Now every time I switch from running
> >> locally to a web server I have to comment out the line. Its not a big
> >> deal
> >> but I'm wonder if I could somehow tell php to use a default document root
> >> if
> >> a session isn't started?
>
> >> Thanks,
> >> Jon
> > <?php
> > /**
> > * May be something like this ?
> > * When function session_start()
> > * is not called or not successed
> > * $_SESSION is not set.
> > */
>
> > $docRoot = isset($_SESSION) ? $_SESSION['Document_Root'] :
> > $_SERVER['DOCUMENT_ROOT'];
> > ?>
>
> lol
> duh... can't believe I didn't think about that ;/
>
> Thanks,
> Jon

Why wouldn't you just /always/ use $_SERVER['DOCUMENT_ROOT'] ?

[Back to original 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

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