教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php提示Warning: file_get_contents(): couldn’t resolve

php提示Warning: file_get_contents(): couldn’t resolve

发布时间:2018-09-24   编辑:jiaochengji.com
教程集为您提供php提示Warning: file,get,contents(): couldn’t resolve等资源,欢迎您收藏本站,我们将为您提供最新的php提示Warning: file,get,contents(): couldn’t resolve资源
在使用file_get_contents函数获取远程文件时提示Warning: file_get_contents(): couldn’t resolve错误了,这个我们可以看出是dns的问题,解决办法也简单。


今天在使用一个Caiji功能的使用,突然间出现“

Warning: file_get_contents() [function.file-get-contents]: couldn't resolve host name in ……

而本地测试却没有问题,从网上查了一些资料,发现是dns的问题。下面是解决方法:

用ssh连接linux vps,  修改vps主机的dns。

vi /etc/resolv.conf

里面的内容直接修改成:

nameserver 114.114.114.114

nameserver 8.8.8.8

保存即可,不用重启。

再次测试,OK!

您可能感兴趣的文章:
php提示Warning: file_get_contents(): couldn’t resolve
PHP Warning: file_get_contents failed to open stream解决办法
php file_get_contents抓取https地址报错的解决办法
php不显示warning方法
PHP出现Warning: scandir()问题的解决方法
Warning: mysql_free_result():
php抓取https内容的方法
PHP实现抓取HTTPS内容的方法和错误处理
php file_get_contents函数抓取页面信息的代码
PHP检测给定url是否是404页面的方法

[关闭]
~ ~