/**
* post 请求
* @param $url
* @param $post_data
* @return bool|string
*/
public static function curlPost($url, $post_data) {
$ch = curl_init();
$post_string = json_encode($post_data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_POST, 1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
php发送post请求
最新推荐文章于 2023-06-30 15:59:20 发布