用file_get_contents读取https的链接 Unable to find the wrapper "https"

file_get_contents读取https的链接,碰到这样一个错误:

Unable to find the wrapper "https" - did youforget to enable it when you configured PHP?

原因是phpstudy没有开启openssl模块,在配置文件中php.ini中把extension=php_openssl.dll前面的;删掉,重启服务就可以了。

相关知识:上面说的windows下的php,在linux下的PHP,就必须安装openssl模块,安装好了以后就可以访问了。如果服务器你不能修改配置的话,那么就使用curl函数来替代file_get_contents函数,当然不是简单的替换啊。还有相应的参数配置才能正常使用curl函数。

你可能感兴趣的:(服务器)