[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lies in education [was Re: The "loop and a half"]

Chris Angelico <rosuav at gmail.com> writes:

> On Thu, Oct 12, 2017 at 11:55 AM, Ben Bacarisse <ben.usenet at bsb.me.uk> wrote:
>> Chris Angelico <rosuav at gmail.com> writes:
>>> it binds your URLs to
>>> the concrete file system. That may not seem like too much of a
>>> problem, but it's a pretty big limitation; you can't have URLs like
>>> "https://en.wikipedia.org/wiki/Foo"; without some help from the web
>>> server, eg Apache's mod_rewrite.
>> I don't follow this.  Your "can't" and "big limitation" suggests
>> something inevitable, but I don't see it as an intrinsic problem with
>> the language.  I'm sure PHP is not as flexible as the frameworks you
>> mention, but you are not tied to URLs mapping to files.  Maybe you meant
>> that this is what often happens, or what most people do, with PHP.
> How would you, with PHP itself, handle database-provided URLs? The
> only way I've ever seen it done is at an external level - such as
> mod_rewrite - which means that someone else, *not* the PHP script, is
> managing your URLs. They're pushed to some external config file
> somewhere. That's okay for just one URL pattern, but it doesn't scale
> well, which is why (for example) Wikipedia's editing pages are
> "/w/index.php?...." instead of, say, "/wiki/Foo/edit" or
> "/wiki/edit/Foo".
> Unless you know something I don't?

Provided some early part of the URL is handled by PHP, the rest of the
URL path is provided to PHP in $_SERVER["PATH_INFO"].