當前位置: 首頁>>代碼示例>>PHP>>正文


PHP uri::fromString方法代碼示例

本文整理匯總了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;
 }
開發者ID:alexqwert,項目名稱:kanon,代碼行數:7,代碼來源:view.php

示例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;
 }
開發者ID:alexqwert,項目名稱:kanon,代碼行數:33,代碼來源:controllerPrototype.php

示例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;
 }
開發者ID:alexqwert,項目名稱:kanon,代碼行數:12,代碼來源:widgetController.php

示例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;
 }
開發者ID:ExceptVL,項目名稱:kanon,代碼行數:13,代碼來源:uri.php

示例5: setRelativeUriFromBase

 public function setRelativeUriFromBase($uriString)
 {
     $baseUri = uri::fromString($uriString);
     $this->_relativeUri = uri::fromRequestUri();
     $this->_relativeUri->subtractBase($baseUri);
 }
開發者ID:alexqwert,項目名稱:kanon,代碼行數:6,代碼來源:zenMVC.php


注:本文中的uri::fromString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。