美文网首页
file_get_contents请求非http(s)开头的ur

file_get_contents请求非http(s)开头的ur

作者: lightlightsky | 来源:发表于2015-06-08 09:56 被阅读0次

file_get_contents(path,include_path,context,start,max_length)

功能:

           将文件的内容读入到一个字符串中。

问题:

          file_get_contents请求非http(s)开头的url时报错。

问题原因:

          请求地址不加http(s),file_get_contents函数会把该url当做本地的文件来 查找,一一旦没有查找到就会报错。

          而当请求地址加上http(s)后,file_get_contents函数会通过url获取网页内容。

相关文章

网友评论

      本文标题:file_get_contents请求非http(s)开头的ur

      本文链接:https://www.haomeiwen.com/subject/gwurqttx.html