本文整理匯總了PHP中uri::fromString方法的典型用法代碼示例。如果您正苦於以下問題:PHP uri::fromString方法的具體用法?PHP uri::fromString怎麽用?PHP uri::fromString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類uri
的用法示例。
在下文中一共展示了uri::fromString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rel
public function rel($relativeUri)
{
$relativeUri = $relativeUri instanceof uri ? $relativeUri : uri::fromString(strval($relativeUri));
$rel = new uri();
$rel->setPath(array_merge($this->_uri->getPath(), $relativeUri->getPath()));
return $rel;
}
示例2: arel
public function arel($relativeUri = '', $absolute = false, $stripLast = false)
{
$relativeUri = strval($relativeUri);
//if (is_object($relativeUri))
if (is_string($relativeUri)) {
$relativeUri = uri::fromString($relativeUri);
}
$a = array();
$rel = $this->_relativeUri->getPath();
if ($stripLast) {
$xrel = array_reverse($rel);
$stripa = $relativeUri->getPath();
foreach ($xrel as $action) {
$stripAction = array_pop($stripa);
if ($action != $stripAction) {
break;
}
array_pop($rel);
}
}
//$relativeUri
foreach ($rel as $action) {
$a[] = $action;
}
if (!is_object($relativeUri)) {
throw new Exception('$relativeUri not an object');
}
$relativeUri->setPath(array_merge($this->_baseUri->getPath(), $a, $relativeUri->getPath()));
if ($absolute) {
return 'http://' . request::getDomainName() . $relativeUri;
}
return $relativeUri;
}
示例3: wrel
public function wrel($relativeUri = '')
{
$relativeUri = strval($relativeUri);
if (is_string($relativeUri)) {
$relativeUri = uri::fromString($relativeUri);
}
if (!is_object($relativeUri)) {
throw new Exception('$relativeUri not an object');
}
$relativeUri->setPath(array_merge($this->_widgetUri->getPath(), $relativeUri->getPath()));
return $relativeUri;
}
示例4: rel
public function rel($uri)
{
if (!is_object($uri)) {
$uri = uri::fromString(strval($uri));
}
$rel = clone $this;
$path = $rel->getPath();
foreach ($uri->getPath() as $p) {
$path[] = $p;
}
$rel->setPath($path);
return $rel;
}
示例5: setRelativeUriFromBase
public function setRelativeUriFromBase($uriString)
{
$baseUri = uri::fromString($uriString);
$this->_relativeUri = uri::fromRequestUri();
$this->_relativeUri->subtractBase($baseUri);
}