Does file_get_contents() use a cache?

夙愿已清 提交于 2019-12-20 05:21:31

问题


If I write:

 $mypage=file_get_contents("www.mywebsite.com/mypage.htm");

The first time I run the script, file_get_contents() will surely make a HTTP request to www.mywebsite.com for mypage.htm, and get a response with the content of mypage.htm.

But every next time I run the script, will file_get_contents() get the real file on www.mywebsite.com? Or it has some kind of cache on the localhost?


回答1:


It does not. However, there will be a speed-up because the DNS resolution step may be faster on subsequent tries (till the cached entry expires), as the DNS records are cached by the server's OS.



来源:https://stackoverflow.com/questions/11708332/does-file-get-contents-use-a-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!