Posted by Toby Inkster on 11/19/53 11:47
Alan Little wrote:
> I understand; that's what I like about __FILE__. I was wondering if there
> were a similar constant with the same value as $PHP_SELF.
A PHP script *can never _know_* what URL it was requested at. (Nor can a
Perl script, nor any other scripting language.)
For example:
http://server2.example.org/foo.php contains the following:
<?php
echo $_SERVER['PHP_SELF'];
?>
http://server1.example.org/.htaccess contains the following:
RewriteEngine on
RewriteRule ^(.*)\.php$ http://server2.example.org/foo.php
Now I visit "http://server1.example.org/bar.php", the script will echo
back to me "foo.php".
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|