[nycphp-talk] Best practices for combining paths?
Paul A Houle
paul at devonianfarm.com
Mon Mar 30 17:22:58 EDT 2009
I pretty frequently write code like
$url_base="http://somesite.com/system/controller";
$path="object_type/verb.modifier/object_id";
$url="{$url_base}/{$path}";
note that this working correctly depends sensitively on how paths are
used, for instance, if somebody puts a slash at the end of $url_base,
you wind up with a double slash in the path. That doesn't usually have
a disasterous effect, but I'm a stickler about url canonicalizaton.
My question is, am I missing a good PHP built-in for combining parts of
URLs or filesystem paths? Is there a good library I should use?
More information about the talk
mailing list