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

2015-06-08  本文已影响0人  lightlightsky

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获取网页内容。

上一篇 下一篇

猜你喜欢

热点阅读