简体   繁体   中英

RSS feed created with PHP is not updating

I created a RSS feed using PHP. Basically using the header:

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

And then creating the xml string and outputting it.

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.

How do I overcome this problem ?

You could try using HTTP cache directives.

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

Tip: Do not create the XML as a string. Use the DomDocument API to create the XML and it will be ALWAYS right. No strange encoding and stuff like that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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