PHP file_get_contents域名超级慢,连接IP却很快?
用服务器ping了下接口服务器的域名和IP如下,访问接口时候采用域名的话,服务器就会超时,每次都超过20秒,然后直接连接失败,不知道为什么,用IP就不会,怎么解决
一、ping域名
array(9) {
[0]=>
string(59) "PING www.honourt.com (112.74.100.239) 56(84) bytes of data."
[1]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=1 ttl=50 time=45.8 ms"
[2]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=2 ttl=50 time=45.5 ms"
[3]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=3 ttl=50 time=45.9 ms"
[4]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=4 ttl=50 time=46.6 ms"
[5]=>
string(0) ""
[6]=>
string(39) "--- www.honourt.com ping statistics ---"
[7]=>
string(62) "4 packets transmitted, 4 received, 0% packet loss, time 7223ms"
[8]=>
string(52) "rtt min/avg/max/mdev = 45.594/45.999/46.636/0.387 ms"
}
二、ping ip
array(9) {
[优艾设计网_PS百科0]=>
string(58) "PING 112.74.100.239 (112.74.100.239) 56(84) bytes of data."
[1]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=1 ttl=50 time=45.6 ms"
[2]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=2 ttl=50 time=46.0 ms"
[3]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=3 ttl=50 time=45.6 ms"
[4]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=4 ttl=50 time=45.9 ms"
[5]=>
string(0) ""
[6]=>
string(38) "--- 112.74.100.239 ping statistics ---"
[7]=>
string(62) "4 packets transmitted, 4 received, 0% packet loss, time 3051ms"
[8]=>
string(52) "rtt min/avg/max/mdev = 45.629/45.814/46.025/0.237 ms"
}
jakie1983 2022-07-13 07:37 优艾设计网_在线设计
建议楼主换个稳定的DNS试试 可以换成阿里云的DNS http://www.alidns.com/
柯阳 优艾设计网_Photoshop论坛 2022-07-13 07:43
其实最主要的原因还是DNS不行。
gjb1983 2022-07-13 07:51 优艾设计网_PS问答
可以尝试在本地修改绑定域名。
e04****94 2022-07-13 07:54 优艾设计网_Photoshop论坛
dns有问题吧
灯下的痕迹 2022-07-13 07:56
建议换成百度的D优艾设计网_设计百科NS 或者 阿里云的 DNS 试试看。
精彩评论