Reply to Re: Checking variables in an include

Your name:

Reply:


Posted by Andy Hassall on 10/06/06 22:36

On 6 Oct 2006 15:30:18 -0700, "Victor" <big.boss@chefmail.de> wrote:

>could anybody explain the following phenomen :
>
>I have this line in my project :
>
>include
>"http://".$domain."/help/".$language."/".$defaultIndex."/".$help.".php";
>
>This construct properly includes the file I need to. And the included
>file contains the following line :
>
>echo $domain;
>
>- and on this place comes nothing: obviously, the variable '$domain' is
>not set for the <help.php>.
>
>Why ?

How are you expecting it to be set? You're (almost certainly) executing the
remote PHP file in a totally different context - all you're include()ing is the
output of the PHP file from the remote server.

The only way it could work is if the webserver you're calling returns the PHP
source verbatim, without processing it, in which case it's run in the same
context as the calling script.

Are you sure you want to be doing remote HTTP includes? Including from the
filesystem is by far the more common usage, and is more likely to behave how
you expect.

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

[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

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