PHP Class Gaoming13\WechatPhpSdk\Utils\HttpCurl

Show file Open project: gaoming13/wechat-php-sdk Class Usage Examples

Public Methods

Method Description
get ( string $url, string $data_type = 'text' ) : mixed 模拟GET请求
post ( string $url, array $fields, string $data_type = 'text' ) : mixed 模拟POST请求

Method Details

get() public static method

模拟GET请求
public static get ( string $url, string $data_type = 'text' ) : mixed
$url string
$data_type string
return mixed Examples: ``` HttpCurl::get('http://api.example.com/?a=123&b=456', 'json'); ```

post() public static method

模拟POST请求
public static post ( string $url, array $fields, string $data_type = 'text' ) : mixed
$url string
$fields array
$data_type string
return mixed Examples: ``` HttpCurl::post('http://api.example.com/?a=123', array('abc'=>'123', 'efg'=>'567'), 'json'); HttpCurl::post('http://api.example.com/', '这是post原始内容', 'json'); 文件post上传 HttpCurl::post('http://api.example.com/', array('abc'=>'123', 'file1'=>'@/data/1.jpg'), 'json'); ```