Re: Submitting variables via /'s
| From: | Rasmus Lerdorf | Date: | Fri, 05 Oct 2001 17:05:19 +0000 |
| Subject: | Re: Submitting variables via /'s | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70120@lists.php.net to get a copy of this message | ||
> > Yes, $PHP_SELF would include /1/2/3. $SCRIPT_NAME wouldn't have it though
> > since Apache fills that in with the script it executes. Or you could
> > simply look at $PATH_INFO and strip the contents of $PATH_INFO from the
> > end of $PHP_SELF.
>
> Aha! Good. Now, does anyone have a link to documentation on how to use
> this method?
> (I forgot to ask that, duh)
Nothing to it. All you really need to know is that $PATH_INFO will
contain /1/2/3 simply pick out what you need using something like:
list($arg1,$arg2,$arg3) = explode('/',$PATH_INFO);
There is nothing to change configuration-wise in either PHP or Apache.
What you can do is get a bit fancier and get rid of the .php from the URL
and use:
http://domain.com/blah/1/2/3
In your Apache config you would use:
<Location "/blah">
ForceType application/x-httpd-php
</Location>
And then you would simply name your PHP script 'blah' and stick it in your
document root directory. But this is not needed if you are happy with:
http://domain.com/blah.php/1/2/3
Here the .php extension tells Apache that blah.php is a PHP script that
should be executed.
-Rasmus