PHP Class think\Url

Show file Open project: top-think/framework Class Usage Examples

Protected Properties

Property Type Description
$root 生成URL地址的root

Public Methods

Method Description
build ( string $url = '', string | array $vars = '', string | boolean $suffix = true, boolean | string $domain = false ) : string URL生成 支持路由反射
getRuleUrl ( $rule, &$vars = [] ) 匹配路由地址
root ( $root ) 指定当前生成URL地址的root

Protected Methods

Method Description
parseDomain ( &$url, $domain ) 检测域名
parseSuffix ( $suffix ) 解析URL后缀
parseUrl ( $url, $domain ) 直接解析URL地址

Method Details

build() public static method

URL生成 支持路由反射
public static build ( string $url = '', string | array $vars = '', string | boolean $suffix = true, boolean | string $domain = false ) : string
$url string 路由地址
$vars string | array 参数(支持数组和字符串)a=val&b=val2... ['a'=>'val1', 'b'=>'val2']
$suffix string | boolean 伪静态后缀,默认为true表示获取配置值
$domain boolean | string 是否显示域名 或者直接传入域名
return string

getRuleUrl() public static method

匹配路由地址
public static getRuleUrl ( $rule, &$vars = [] )

parseDomain() protected static method

检测域名
protected static parseDomain ( &$url, $domain )

parseSuffix() protected static method

解析URL后缀
protected static parseSuffix ( $suffix )

parseUrl() protected static method

直接解析URL地址
protected static parseUrl ( $url, $domain )

root() public static method

指定当前生成URL地址的root
public static root ( $root )

Property Details

$root protected static property

生成URL地址的root
protected static $root