|
Posted by Alan Little on 11/19/80 11:47
Carved in mystic runes upon the very living rock, the last words of Chung
Leong of comp.lang.php make plain:
> Alan Little wrote:
>> I think the uses I listed are pretty rational.
>
> Not to be overly critical, but you just cited PHP_SELF's function as
> its ration d'etre. We all know it let you figure out what URI caused
> the script to fire. The question is why you'd want to know that.
Ah, ISWYM.
A couple of examples:
1. Phorm plugins use it to ensure they're being called from Phorm.
I encourage users to secure their plugins directory with .htaccess
or equivalent for their server, but users don't always do as they're
encouraged. The idea is to prevent
http://www.example.com/phorm/plugins/someplugin.php
2. I have a homebrew template processor I use in all my applications.
The calling script can, of course, specify the template, but if it
doesn't, the default is (for example) example.html if called from
example.php. Using $PHP_SELF works fine for me, but I've been thinking
of making it generally available.
>> How do you mean? I don't see how the browser enters into it.
>
> Some people, myself include, like to put insert PHP_SELF into a form
> tag's action attribute when the form submits back to the same script.
> You could just as well leave attribute blank. But somehow it seems
> kooky. The same with anchor tags. For linking to the current page but
> with different GET parameters, one could just start the href attribute
> with a question mark. Yet many people, myself include again, would
> stick it PHP_SELF. It's driven by a sort of fear that the browser
> wouldn't build the full URL from the relative parts correctly.
Ah, I see.
--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Navigation:
[Reply to this message]
|