本文整理汇总了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);
}
示例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;
}
示例3: testNormalizeMailto
public function testNormalizeMailto()
{
$results = Mapper::normalize("mailto:spaghetti@spaghettiphp.org");
$expected = "mailto:spaghetti@spaghettiphp.org";
$this->assertEqual($expected, $results);
}