当前位置: 首页>>代码示例>>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;未经允许,请勿转载。