解决php函数file_get_contents返回false的解决方法:
1. 看看php.ini里的这个这俩必须是开启的 extension=php_openssl.dll 和 allow_url_fopen=on 是开启的
2. 如果以上配置都是开启的,那可能是服务商把file_get_contents关闭了;这时只能自己写一个http请求函数了。
自写的http_request函数代码,直接拿去用好
public function http_request($url, $data = null) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); if (!empty($data)) { curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $info = curl_exec($curl); curl_close($curl); return $info; }相关参考:本站

