public function index()
{
$post_data = array(
'appkey' => '******',
'current' => 1,
'pageSize' => 10,
'searchDate'=>'2020-12-16'
);
echo $this->curls('http://域名/tickets/getList', json_encode($post_data));
}
function curls($url, $data_string) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-AjaxPro-Method:ShowList',
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($data_string))
);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
php的POST请求,json形式
最新推荐文章于 2021-12-02 15:36:35 发布