Example #1
0
 /**
  * 解析路由参数
  */
 public function match()
 {
     if (!$this->_pathinfo || !preg_match($this->pattern, $this->_pathinfo, $matches) || strpos($this->_pathinfo, '.php') !== false) {
         return;
     }
     list(, $_args) = explode('?', $this->_pathinfo . '?', 2);
     $_args = trim($_args, '?');
     $_args = UrlHelper::url_to_args($_args, true, $this->separator);
     $params = array();
     foreach ($this->params as $k => $v) {
         if (isset($matches[$v])) {
             $params[$k] = trim($matches[$v], '-/');
         }
         unset($_args[$k]);
     }
     $_args && ($params = array_merge($params, $_args));
     if (defined('SUB_DOMAIN')) {
         $params['app'] = isset($this->_config['application']) ? $this->_config['application'] : SUB_DOMAIN;
     }
     // 设定应用名称;
     $_GET = array_merge($_GET, $params);
     return;
 }