user461316
user461316

Reputation: 913

Include GET Variable in include(path)

I am trying to do an include(dirname(FILE), '/../file.php?variable=VAR'), but it is unable to find the location when I use the variable.

The directory is located one above the current one where the file is. Is it possible to pass the variables through the include?

Upvotes: 0

Views: 126

Answers (2)

moonwave99
moonwave99

Reputation: 22817

You can't, though you won't need this at all, because $_GET's scope is global [i.e. accessible from every script you run].

Just to be clear:

include($path) searches the filesystem for a resource, then processes it.

http://somesite.com/index.php?key=value is a URL, whose part after the ? sign is called query.

Upvotes: 1

Aman Gautam
Aman Gautam

Reputation: 3579

No.

By using include, you include the source code from the file as it is. I guess you want to define a function inside the included file and call it to get the result.

Upvotes: 0

Related Questions