PHP Class Cml\Http\Request

Show file Open project: linhecheng/cmlphp Class Usage Examples

Public Methods

Method Description
baseUrl ( ) : string 获取基本URL地址
curl ( string $url, array $parameter = [], array $header = [], string $type = 'json', integer $timeout = 10 ) : boolean | mixed 发起curl请求
getBinaryData ( ) : string 获取POST过来的二进制数据,与手机端交互
getService ( string $name = '' ) : string 获取SERVICE信息
host ( ) : string 获取主机名称
ip ( ) : string 获取IP地址
isAjax ( ) : boolean 判断是否为AJAX请求
isCli ( ) : boolean 判断是否以cli方式运行
isGet ( ) : boolean 判断是否为GET请求
isMobile ( ) : boolean 判断是否为手机浏览器
isPost ( ) : boolean 判断是否为POST请求
operatingSystem ( ) : boolean 返回操作系统类型
requestTime ( ) : mixed 获取请求时间
userAgent ( ) : string 获取用户标识

Method Details

baseUrl() public static method

获取基本URL地址
public static baseUrl ( ) : string
return string

curl() public static method

发起curl请求
public static curl ( string $url, array $parameter = [], array $header = [], string $type = 'json', integer $timeout = 10 ) : boolean | mixed
$url string 要请求的url
$parameter array 请求参数
$header array header头信息
$type string 请求的数据类型 json/post/file/get
$timeout integer 请求的超时时间默认10s
return boolean | mixed

getBinaryData() public static method

获取POST过来的二进制数据,与手机端交互
public static getBinaryData ( ) : string
return string

getService() public static method

获取SERVICE信息
public static getService ( string $name = '' ) : string
$name string SERVER的键值名称
return string

host() public static method

获取主机名称
public static host ( ) : string
return string

ip() public static method

获取IP地址
public static ip ( ) : string
return string

isAjax() public static method

判断是否为AJAX请求
public static isAjax ( ) : boolean
return boolean

isCli() public static method

判断是否以cli方式运行
public static isCli ( ) : boolean
return boolean

isGet() public static method

判断是否为GET请求
public static isGet ( ) : boolean
return boolean

isMobile() public method

判断是否为手机浏览器
public isMobile ( ) : boolean
return boolean

isPost() public static method

判断是否为POST请求
public static isPost ( ) : boolean
return boolean

operatingSystem() public static method

返回操作系统类型
public static operatingSystem ( ) : boolean
return boolean true为win false为unix

requestTime() public static method

获取请求时间
public static requestTime ( ) : mixed
return mixed

userAgent() public static method

获取用户标识
public static userAgent ( ) : string
return string