2
/無法通過php cURL發送多維Json數組。 所以在下面的代碼我發送它作爲將難以在python檢索對象的陣列/如何通過php cURL發送多維Json數組
$_api_url="http://example.com" ;
$params = http_build_query(array('data_Details' => json_encode($request)));
//initialize and setup the curl handler
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_api_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
//execute request
$result = curl_exec($ch);
//close connection
curl_close($ch);
@ammu爲什麼?哪個語句不接受多維數組? 'json_encode()'是接受數組的唯一語句... – RichardBernards 2014-12-03 12:19:58
您從提供的代碼中收到的錯誤是什麼? – RichardBernards 2014-12-03 12:25:50
如果我使用此代碼,$ data_string是多維數組則響應將是NULL – ammu 2014-12-03 12:37:35