file_get_contents 报错 failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

file_get_contents 报错 failed to open stream

  • 改php.ini 的 allow_url_fopen = On
  • php.ini 的 user_agent=”PHP”(表示通过哪种脚本访问网络)改成 user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)” 表示模拟 浏览器访问

但是发现我的问题还是没有解决后面再 segmentfault 中看到一个提示,让 注意 host 问题
实际上,我的域名的确是本地设置的,使用file_get_contents 的时候 并没有 发送到 我的开发环境

结果是 你file_get_content(url) 的路径是否准确,这个很关键

猜你喜欢

转载自blog.csdn.net/houdahua/article/details/81290071