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


PHP Mapper::normalize方法代碼示例

本文整理匯總了PHP中Mapper::normalize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mapper::normalize方法的具體用法?PHP Mapper::normalize怎麽用?PHP Mapper::normalize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mapper的用法示例。


在下文中一共展示了Mapper::normalize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: write

 public static function write($name, $value, $expires = null)
 {
     $self = self::getInstance();
     $expires = $self->expire($expires);
     $path = Mapper::normalize(Mapper::base() . $self->path);
     return setcookie($self->name . '[' . $name . ']', self::encrypt($value), $expires, $path, $self->domain, $self->secure);
 }
開發者ID:klawdyo,項目名稱:spaghettiphp,代碼行數:7,代碼來源:Cookie.php

示例2: parseUrl

 /**
  *  Faz a interpretação da URL, identificando as partes da URL.
  * 
  *  @param string $url URL a ser interpretada
  *  @return array URL interpretada
  */
 public function parseUrl($url = null)
 {
     $here = Mapper::normalize(is_null($url) ? Mapper::here() : $url);
     $url = Mapper::getRoute($here);
     $prefixes = join("|", Mapper::getPrefixes());
     $parts = array("here", "prefix", "controller", "action", "id", "extension", "params");
     preg_match("/^\\/(?:({$prefixes})(?:\\/|(?!\\w)))?(?:([a-z_-]*)\\/?)?(?:([a-z_-]*)\\/?)?(?:(\\d*))?(?:\\.([\\w]+))?(?:\\/?(.*))?/i", $url, $reg);
     foreach ($parts as $k => $key) {
         $this->path[$key] = $reg[$k];
     }
     $this->path["namedParams"] = $this->path["params"] = array();
     foreach (split("/", $reg[6]) as $param) {
         if (preg_match("/([^:]*):([^:]*)/", $param, $reg)) {
             $this->path["namedParams"][$reg[1]] = urldecode($reg[2]);
         } elseif ($param != "") {
             $this->path["params"][] = urldecode($param);
         }
     }
     $this->path["here"] = $here;
     if (empty($this->path["controller"])) {
         $this->path["controller"] = Mapper::getRoot();
     }
     if (empty($this->path["action"])) {
         $this->path["action"] = "index";
     }
     if (!empty($this->path["prefix"])) {
         $this->path["action"] = "{$this->path['prefix']}_{$this->path['action']}";
     }
     if (empty($this->path["id"])) {
         $this->path["id"] = null;
     }
     if (empty($this->path["extension"])) {
         $this->path["extension"] = Config::read("defaultExtension");
     }
     return $this->path;
 }
開發者ID:simaopedros,項目名稱:spaghettiphp,代碼行數:42,代碼來源:dispatcher.php

示例3: testNormalizeMailto

 public function testNormalizeMailto()
 {
     $results = Mapper::normalize("mailto:spaghetti@spaghettiphp.org");
     $expected = "mailto:spaghetti@spaghettiphp.org";
     $this->assertEqual($expected, $results);
 }
開發者ID:simaopedros,項目名稱:spaghettiphp,代碼行數:6,代碼來源:mapper.test.php


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