php curl 400

程序裏面使用 curl 訪問接口, 報400錯誤,win 下正常, 上到 linux 報400 錯誤,postman 和瀏覽器都能正常訪問接口,linux

查閱資料後反現是** curl 版本問題**,瀏覽器

當curl 使用 post 方式訪問接口,而post 數據又爲空時就會出現這種狀況,curl

解決: 添加任意一個 post 字段post

curl_setopt($ch,  CURLOPT_POSTFIELDS, 'xx=xxx');
相關文章
相關標籤/搜索