本文整理汇总了PHP中url::strip_query方法的典型用法代码示例。如果您正苦于以下问题:PHP url::strip_query方法的具体用法?PHP url::strip_query怎么用?PHP url::strip_query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类url
的用法示例。
在下文中一共展示了url::strip_query方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crawl
function crawl()
{
$path = url::strip_query($this->raw);
$path = (array) str::split($path, '/');
if (a::first($path) == 'index.php') {
array_shift($path);
}
// parse params
foreach ($path as $p) {
if (str::contains($p, ':')) {
$parts = explode(':', $p);
if (count($parts) < 2) {
continue;
}
$this->params->{$parts}[0] = $parts[1];
} else {
$this->path->_[] = $p;
}
}
// get the extension from the last part of the path
$this->extension = f::extension($this->path->last());
if ($this->extension != false) {
// remove the last part of the path
$last = array_pop($this->path->_);
$this->path->_[] = f::name($last);
}
return $this->path;
}
示例2: path
function path($key = null, $default = null)
{
$path = self::$path;
if (!$path) {
$path = url::strip_query(self::raw());
$path = (array) str::split($path, '/');
self::$path = $path;
}
if ($key === null) {
return $path;
}
return a::get($path, $key, $default);
}
示例3: extension
/**
* Gets the extension of a file
*
* @param string $file The filename or path
* @return string
*/
static function extension($filename)
{
$ext = str_replace('.', '', strtolower(strrchr(trim($filename), '.')));
$ext = url::strip_query($ext);
$ext = preg_replace('!\\:.*!i', '', $ext);
$ext = preg_replace('!\\#.*!i', '', $ext);
return $ext;
}
示例4: extension
function extension($filename)
{
$ext = str_replace('.', '', strtolower(strrchr(trim($filename), '.')));
return url::strip_query($ext);
}
示例5: map
function map()
{
$url = url::strip_query(server::get('request_uri'));
$url = str_replace(rtrim(c::get('router.root'), '/'), '', $url);
$method = r::method();
foreach (self::$routes as $key => $route) {
if (!in_array($method, $route['methods'])) {
continue;
}
$key = str_replace(')', ')?', $key);
$args = array();
$regex = preg_replace_callback('#@([\\w]+)(:([^/\\(\\)]*))?#', function ($matches) use(&$args) {
$args[$matches[1]] = null;
if (isset($matches[3])) {
return '(?P<' . $matches[1] . '>' . $matches[3] . ')';
}
return '(?P<' . $matches[1] . '>[^/\\?]+)';
}, $key);
if (preg_match('#^' . $regex . '(?:\\?.*)?$#i', $url, $matches)) {
foreach ($args as $k => $v) {
self::$params[$k] = array_key_exists($k, $matches) ? urldecode($matches[$k]) : null;
}
return $route['callback'];
}
}
return false;
}
示例6: filename
/**
* Extracts the filename from a file path
*
* @param string $file The path
* @return string
*/
static function filename($name)
{
$name = basename($name);
$name = url::strip_query($name);
$name = preg_replace('!\\:.*!i', '', $name);
$name = preg_replace('!\\#.*!i', '', $name);
return $name;
}