Does PHP's file_get_contents cache a 301 statu

2019-05-10 21:20发布

If PHP does cache a permanent redirect:

  1. For how long?
  2. Can this period be changed?

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

2条回答
三岁会撩人
2楼-- · 2019-05-10 21:56

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.)

查看更多
萌系小妹纸
3楼-- · 2019-05-10 21:58

If you want more direct control over your http queries I suggest using curl.

查看更多
登录 后发表回答