Jump to content

Question about $_SERVER['PHP_SELF']


SirChick

Recommended Posts

If you use the $_SERVER['PHP_SELF'] which checks what page the user is viewing....

 

What would it say if you had that in an include?

 

Example...

<?php// this include contains the $_SERVER['PHP_SELF'] that checks what page the user is viewing
Include("includetest.php");

//the actual page the user is viewing etc
?>

 

Edited : i didn't mean seessions lol

 

Now if i echo'd it ... would it say "includetest.php" because that is where the session is scripted to or would it say the actual page the user is viewing?

Link to comment
https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/
Share on other sites

Thats in a global include.. im just referring to how does the built in function work when it comes to displaying what url the user views.

 

Will it show the file of the include where the session is or will it show the file name of the script the user is viewing...

Wait, what built-in function? I only know that you create sessions yourself. ???

$_SERVER['PHP_SELF']  function get the current url and page your on.......

 

'PHP_SELF'

    The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.

 

link to more predifind varables

http://uk2.php.net/reserved.variables

I'm not sure why people ask these questions. You typed more code and text in your post then you would have needed to type to make a simple example and test it yourself.

 

Just seems a slow method of getting answers.

Well no, it was slow because (s)he asked the wrong question to start out with.

I agree. I'm sure the Greeks had a word for "fear of experimenting" (some sort of phobia). There certainly seems to be an epidemic.

 

edit: according to BabelFish it's "πειραματισμόςφόβος"

 

http://www.phpfreaks.com/forums/index.php/topic,174628.msg772619.html#msg772619

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.