tdt/uri

您是否曾经尝试在PHP中获取当前的URI?这个方法应该可以解决这个问题。

dev-master 2013-06-19 17:53 UTC

This package is auto-updated.

Last update: 2024-08-29 03:35:21 UTC


README

是否曾想获取正确的请求URI/URL在PHP中?这个方法应该可以解决这个问题。

API

$ruri = $RequestURI::getInstance();
$ruri->getProtocol(); //returns http or https
$ruri->getHostname(); //returns the hostname
$ruri->getFilters(); //return the path as an array
$ruri->getGET(); //all GET parameters in an associative array
$ruri->getGivenFormat(); //when you add a .json to the end of the URI
$ruri->getRealWorldObjectURI(); //return URI without a format or without GET params
$ruri->getResourcePath(); //the path to the resource
$ruri->getURI(); //realworld object URI plus format and get params. The full URI.