PHP为什么用curl来获取access_token,显示为空,而用file_get_contents来获取 access_token就能显示出来
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx3225919883125899&secret=5913d164a3660264868de68ca02884f2";
/*$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch)*/
$res = file_get_contents($url);
你curl用的是post,access_token是get