\DtApp\ThinkLibrary\service\curlHttpService

通用网络请求 Class HttpService

Summary

Methods
Properties
Constants
__construct()
instance()
url()
data()
headers()
timeout()
cert()
get()
post()
xml()
file()
toArray()
No public properties found
No constants found
initialize()
$app
N/A
httpGet()
httpPost()
httpXml()
httpFile()
$url
$data
$cert
$output
$timeout
$method
$headers
N/A

Properties

$app

$app : \think\App

应用实例

Type

\think\App

$url

$url : 

Type

$data

$data : 

Type

$cert

$cert : 

Type

$output

$output : 

Type

$timeout

$timeout : integer

Type

integer

$method

$method : string

Type

string

$headers

$headers : string

Type

string

Methods

__construct()

__construct(\think\App  $app) 

Service constructor.

Parameters

\think\App $app

instance()

instance(array  $args) : static

静态实例对象

Parameters

array $args

Returns

static

url()

url(string  $str) : $this

配置网络请求接口

Parameters

string $str

Returns

$this

data()

data(  $str) : $this

需要请求的数据

Parameters

$str

Returns

$this

headers()

headers(  $str) : $this

请求头

Parameters

$str

Returns

$this

timeout()

timeout(integer  $int) : $this

超时,默认60s

Parameters

integer $int

Returns

$this

cert()

cert(string  $sslCertPath, string  $sslKeyPath) : $this

证书

Parameters

string $sslCertPath
string $sslKeyPath

Returns

$this

get()

get() : $this

GET请求方式

Returns

$this

post()

post() : $this

POST请求方式

Returns

$this

xml()

xml() : $this

XML请求方式

Returns

$this

file()

file() : $this

XML请求方式

Returns

$this

toArray()

toArray(boolean  $is = true) : array|boolean|mixed|string

返回数组数据

Parameters

boolean $is

Returns

array|boolean|mixed|string

initialize()

initialize() : $this

初始化服务

Returns

$this

httpGet()

httpGet() : boolean|mixed|string

发送GET请求

Returns

boolean|mixed|string

httpPost()

httpPost() : array|boolean|mixed|string

发送Post请求

Returns

array|boolean|mixed|string

httpXml()

httpXml() : string

发送Xml数据

Returns

string

httpFile()

httpFile() : false|string

上传图片

Returns

false|string