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
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. ???

Link to comment
Share on other sites

$_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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.