PHP的file_get_contents是否缓存301状态代码? [英] Does PHP's file_get_contents cache a 301 status code?

查看:84
本文介绍了PHP的file_get_contents是否缓存301状态代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果PHP确实缓存了永久重定向:

If PHP does cache a permanent redirect:


  1. 多长时间?

  2. 这可以吗?

我还将对Perl,Python和其他主要使用的其他语言的默认行为感兴趣用于Web开发

I would also be interested in the default behaviour on this matter of Perl, Python, and any other languages used primarily for web development

推荐答案

http_fopen_wrapper.c file_get_contents()不包含任何缓存逻辑。特别是,它仅响应 Location:标头,而不关心实际的HTTP状态代码。 (它不会是临时重定向还是永久重定向。)

The http_fopen_wrapper.c which is used by file_get_contents() contains no caching logic whatsoever. In particular it responds to the Location: header only, and does not care for the actual HTTP status code. (It does not notice if it's a temporary redirect or a permanent.)

这篇关于PHP的file_get_contents是否缓存301状态代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆