示例#1
0
 static function function_link($params)
 {
     if (isset($params['path'])) {
         $path = $params['path'];
         if (substr($path, -1) != '/') {
             $path .= '/';
         }
     }
     return \Hiano\App\App::getBaseUrl() . $path . $params['uri'];
 }
示例#2
0
文件: Route.php 项目: kasonyang/hiano
 /**
  * 
  * @param array $params
  * @return boolean
  * @throws UrlFormatException
  */
 function format($params)
 {
     $param_arr = [];
     foreach ($params as $pk => $pv) {
         if ($pv !== '') {
             $param_arr[$pk] = $pv;
         }
     }
     if ($this->route) {
         foreach ($this->route as $route) {
             if ($url = $route->format($param_arr)) {
                 return \Hiano\App\App::getBaseUrl() . $url . $this->getSuffix();
             }
         }
     }
     throw new UrlFormatException('无法格式化URL:' . print_r($arr, TRUE));
 }