PHP Class Swoole\Tool

Author: Tianfeng.Han
ファイルを表示 Open project: matyhtf/swoole_framework Class Usage Examples

Public Properties

Property Type Description
$number
$url_add_end
$url_key_join
$url_param_join
$url_prefix

Public Methods

Method Description
array_fullness ( $array ) : unknown_type 数组饱满度
array_iconv ( $in_charset, $out_charset, $data ) 数组编码转换
combine_query ( $urls ) : string 合并URL字串,parse_query的反向函数
dir_copy ( $fdir, $tdir ) 复制目录
dump ( $var ) : mixed 打印数组
endchar ( $string ) : mixed 获取字符串最后一位
export ( mixed $var ) : string 将PHP变量到处为文件内容
fileAppend ( $log, $file = '' )
getHumanSize ( $n, $round = 3 )
getServer ( array $servers ) : mixed 从Server列表中随机选出一个,使用status配置可以实现上线下线管理,weight(0-100)配置权重
get_age ( integer $birth_year, integer $birth_month, integer $birth_date ) : integer 根据生日来计算年龄
get_animal ( integer $birth_year, $format = '1' ) : string 根据生日中的年份来计算所属生肖
get_constellation ( integer $birth_month, integer $birth_date ) : string 根据生日中的月份和日期来计算所属星座*
howLongAgo ( $datetime ) : unknown_type 多久之前
httpExpire ( $lastModifyTime, $expire = 1800 )
num2han ( $num_str ) : mixed 数字转为汉字
num2week ( $num, boolean $two = true ) : string 数字转星期
readFile ( $file, boolean $exclusive = false ) : boolean | string 加锁读取文件
scandir ( $dir )
sendUDP ( $server_ip, $server_port, $data, $timeout = 30 ) : unknown_type 发送一个UDP包
showCost ( $func )
uri ( string $url ) : array 解析URI
urlAppend ( $url, $array )
url_merge ( $key, $value, $ignore = null, $urls = null ) : string URL合并
url_parse_into ( $url, &$request ) : unknown_type URL解析到REQUEST

Method Details

array_fullness() static public method

数组饱满度
static public array_fullness ( $array ) : unknown_type
$array
return unknown_type

array_iconv() static public method

数组编码转换
static public array_iconv ( $in_charset, $out_charset, $data )
$in_charset
$out_charset
$data

combine_query() static public method

合并URL字串,parse_query的反向函数
static public combine_query ( $urls ) : string
$urls
return string

dir_copy() static public method

复制目录
static public dir_copy ( $fdir, $tdir )

dump() static public method

打印数组
static public dump ( $var ) : mixed
$var
return mixed

endchar() static public method

获取字符串最后一位
static public endchar ( $string ) : mixed
$string
return mixed

export() static public method

将PHP变量到处为文件内容
static public export ( mixed $var ) : string
$var mixed
return string

fileAppend() static public method

static public fileAppend ( $log, $file = '' )

getHumanSize() static public method

static public getHumanSize ( $n, $round = 3 )

getServer() static public method

从Server列表中随机选出一个,使用status配置可以实现上线下线管理,weight(0-100)配置权重
static public getServer ( array $servers ) : mixed
$servers array
return mixed

get_age() static public method

用Unix时间戳计算是最准确的,但不太好处理1970年之前出生的情况 而且还要考虑闰年的问题,所以就暂时放弃这种方式的开发,保留思想
static public get_age ( integer $birth_year, integer $birth_month, integer $birth_date ) : integer
$birth_year integer
$birth_month integer
$birth_date integer
return integer

get_animal() static public method

根据生日中的年份来计算所属生肖
static public get_animal ( integer $birth_year, $format = '1' ) : string
$birth_year integer
return string

get_constellation() static public method

根据生日中的月份和日期来计算所属星座*
static public get_constellation ( integer $birth_month, integer $birth_date ) : string
$birth_month integer
$birth_date integer
return string

howLongAgo() static public method

多久之前
static public howLongAgo ( $datetime ) : unknown_type
$datetime
return unknown_type

httpExpire() static public method

static public httpExpire ( $lastModifyTime, $expire = 1800 )

num2han() static public method

数字转为汉字
static public num2han ( $num_str ) : mixed
$num_str
return mixed

num2week() static public method

数字转星期
static public num2week ( $num, boolean $two = true ) : string
$num
$two boolean
return string

readFile() static public method

加锁读取文件
static public readFile ( $file, boolean $exclusive = false ) : boolean | string
$file
$exclusive boolean
return boolean | string

scandir() static public method

static public scandir ( $dir )

sendUDP() static public method

发送一个UDP包
static public sendUDP ( $server_ip, $server_port, $data, $timeout = 30 ) : unknown_type
return unknown_type

showCost() static public method

static public showCost ( $func )

uri() public static method

解析URI
public static uri ( string $url ) : array
$url string
return array $return

urlAppend() static public method

static public urlAppend ( $url, $array )

url_merge() static public method

URL合并
static public url_merge ( $key, $value, $ignore = null, $urls = null ) : string
$key
$value
$ignore
return string

url_parse_into() static public method

URL解析到REQUEST
static public url_parse_into ( $url, &$request ) : unknown_type
$url
$request
return unknown_type

Property Details

$number static_oe public_oe property

static public $number

$url_add_end public_oe static_oe property

public static $url_add_end

$url_key_join public_oe static_oe property

public static $url_key_join

$url_param_join public_oe static_oe property

public static $url_param_join

$url_prefix public_oe static_oe property

public static $url_prefix