PHP Class think\Lang

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

Protected Properties

Property Type Description
$allowLangList 允许语言列表
$langCookieExpire 语言Cookie的过期时间
$langCookieVar 语言Cookie变量
$langDetectVar 语言自动侦测的变量

Public Methods

Method Description
detect ( ) : string 自动侦测设置获取语言选择
get ( string | null $name = null, array $vars = [], string $range = '' ) : mixed 获取语言定义(不区分大小写)
has ( string | null $name, string $range = '' ) : mixed 获取语言定义(不区分大小写)
load ( string $file, string $range = '' ) : mixed 加载语言定义(不区分大小写)
range ( $range = '' ) 设定当前的语言
set ( string | array $name, string $value = null, string $range = '' ) : mixed 设置语言定义(不区分大小写)
setAllowLangList ( array $list ) : void 设置允许的语言列表
setLangCookieExpire ( string $expire ) : void 设置语言的cookie的过期时间
setLangCookieVar ( string $var ) : void 设置语言的cookie保存变量
setLangDetectVar ( string $var ) : void 设置语言自动侦测的变量

Method Details

detect() public static method

自动侦测设置获取语言选择
public static detect ( ) : string
return string

get() public static method

获取语言定义(不区分大小写)
public static get ( string | null $name = null, array $vars = [], string $range = '' ) : mixed
$name string | null 语言变量
$vars array 变量替换
$range string 语言作用域
return mixed

has() public static method

获取语言定义(不区分大小写)
public static has ( string | null $name, string $range = '' ) : mixed
$name string | null 语言变量
$range string 语言作用域
return mixed

load() public static method

加载语言定义(不区分大小写)
public static load ( string $file, string $range = '' ) : mixed
$file string 语言文件
$range string 语言作用域
return mixed

range() public static method

设定当前的语言
public static range ( $range = '' )

set() public static method

设置语言定义(不区分大小写)
public static set ( string | array $name, string $value = null, string $range = '' ) : mixed
$name string | array 语言变量
$value string 语言值
$range string 语言作用域
return mixed

setAllowLangList() public static method

设置允许的语言列表
public static setAllowLangList ( array $list ) : void
$list array 语言列表
return void

setLangCookieExpire() public static method

设置语言的cookie的过期时间
public static setLangCookieExpire ( string $expire ) : void
$expire string 过期时间
return void

setLangCookieVar() public static method

设置语言的cookie保存变量
public static setLangCookieVar ( string $var ) : void
$var string 变量名称
return void

setLangDetectVar() public static method

设置语言自动侦测的变量
public static setLangDetectVar ( string $var ) : void
$var string 变量名称
return void

Property Details

$allowLangList protected static property

允许语言列表
protected static $allowLangList

$langCookieExpire protected static property

语言Cookie的过期时间
protected static $langCookieExpire

$langCookieVar protected static property

语言Cookie变量
protected static $langCookieVar

$langDetectVar protected static property

语言自动侦测的变量
protected static $langDetectVar