更新兼容性

This commit is contained in:
yaooo 2023-11-18 09:33:31 +08:00
parent 8a7a27fccd
commit 88e9097b53
1 changed files with 6 additions and 1 deletions

View File

@ -337,7 +337,12 @@ function curl_post($url,$data,$headers=[]) {
//设置为post方式请求
curl_setopt($ch, CURLOPT_POST, 1);
//添加参数
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
if (is_array($data)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
}
if (is_string($data)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
//设置header
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//关闭请求资源