简体   繁体   English

用PHP创建的RSS feed未更新

[英]RSS feed created with PHP is not updating

I created a RSS feed using PHP. 我使用PHP创建了RSS feed。 Basically using the header: 基本上使用标题:

header("Content-Type: application/rss+xml; charset=ISO-8859-1");

And then creating the xml string and outputting it. 然后创建xml字符串并输出。

Now the problem is even when I make changes to the PHP script that outputs the RSS feed, it takes forever for those changes to propogate and be seen in the RSS reader. 现在的问题是,即使我对输出RSS提要的PHP脚本进行了更改,这些更改也永远需要在RSS阅读器中传播和看到。

How do I overcome this problem ? 我该如何克服这个问题?

You could try using HTTP cache directives. 您可以尝试使用HTTP缓存指令。

I'd suggest using this for testing: 我建议使用此进行测试:

Cache-Control: no-cache

And this for production: 并用于生产:

Cache-Control: max-age=1800

It will make the content expire every 30 minutes (1800 = 30*60). 它将使内容每30分钟过期一次(1800 = 30 * 60)。

Tip: Do not create the XML as a string. 提示:不要将XML创建为字符串。 Use the DomDocument API to create the XML and it will be ALWAYS right. 使用DomDocument API创建XML,并且总是正确的。 No strange encoding and stuff like that. 没有奇怪的编码之类的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM