file_get_contents函数不能使用的解决方法

今天开发微信公众平台的时候 使用file_get_contents 去获得token 结果一直返回false。百度了一下,大部分都是说用curl

偶然发现可能是openssl没有开启的问题,开启openssl问题解决,开启方法 php.ini extension=openssl.dll

curl get抓取数据的方法

1 $ch = curl_init();
2 $timeout = 5; 
3 curl_setopt ($ch, CURLOPT_URL, $token_url);
4 curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
5 curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
6 $response = curl_exec($ch);
7 curl_close($ch);
原文地址:https://www.cnblogs.com/tl542475736/p/5009479.html