shaoqin 发表于 2017-12-31 09:31:57

PHP curl传输json数据及接收

……  

  

//开启header  
curl_setopt($curl, CURLOPT_HEADER, true);
  
//类型为json
  
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
  'Content-Type: application/json; '
  
)
  
);
  

  
//post传递
  
curl_setopt($curl, CURLOPT_POST, 1);
  
curl_setopt($curl, CURLOPT_POSTFIELDS, ($json));
  
……
  ……
  
//接收
  
$json = ("php://input");
  
$json = json_decode($json, true);
  
($json);
  
……
页: [1]
查看完整版本: PHP curl传输json数据及接收