FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Logic behind this?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Logic behind this? [message #171493 is a reply to message #171490] Thu, 06 January 2011 12:07 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(Modafanil)

> I tried to include one PHP file from within another one that is running on a
> webserver:
>
> require_once('test.php?message=this');
>
> Without the query string the inclusion works fine. Add the query string,
> however, and the server refuses with 'can't find a matching file or
> directory'.

Correct.

> Wouldn't PHP be a more consistent language if it were possible to pass query
> strings during file inclusion

This is possible, but only if you include the file with an HTTP request,
which you don't really want (too expensive, too slow and maybe even a
security problem). A normal file include like above doesn't know about
query strings, because there's no server involved to interpret them.

> and then be able to access the parameters as
> maybe $_SERVER['QUERY_STRING'] or $_GET['message'] within the included file?

These superglobals are available everywhere.

Micha
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: the changeover to mysqli
Next Topic: [urgent] need solution of Questions, in context of PHP5
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 14:52:14 GMT 2024

Total time taken to generate the page: 0.04429 seconds