本文整理汇总了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);
}