예제 #1
0
파일: Request.php 프로젝트: hubs/yuncms
 /**
  * 获取基础URL
  *
  * 这里是去除了脚本文件以及访问参数信息的URL地址信息:
  *
  * <pre>Example:
  * 请求: http://www.tintsoft.com/example/index.php?a=test
  * 1]如果: $absolute = false:
  * 返回: example
  * 2]如果: $absolute = true:
  * 返回: http://www.tintsoft.com/example
  * </pre>
  *
  * @param boolean $absolute 是否返回主机信息
  * @return string
  * @throws Base_Exception 当返回信息失败的时候抛出异常
  */
 public static function get_base_url($absolute = false)
 {
     if (self::$_base_url === null) {
         self::$_base_url = rtrim(dirname(self::get_script_url()), '\\/.');
     }
     return $absolute ? self::get_host_info() . self::$_base_url : self::$_base_url;
 }