我可以阻止iCal缓存我的PHP生成的iCalendar提要吗


Can I stop iCal from caching my PHP-generated iCalendar feed?

我使用PHP制作了一个动态生成的iCalendar提要,坚持RFC 5545。除了iCal(即Mac OS X的内置日历程序)似乎拒绝反映之前下载的事件的更新外,它在大多数情况下都运行良好。我认为这是由于缓存。有没有办法告诉iCal不要缓存我的订阅源?

编辑:哦,是的,我忘了提一下,我已经尝试过让每个VEVENT在每次调用提要时都有一个不同的UID(我的UID格式是"id",其中是RFC 5545的DATE-time格式中的当前时间,是我数据库中事件的唯一id)。我也尝试过在标题中使用内容类型;无论我将其设置为text/plain还是text/calendar

,都会出现此问题

我从未处理过iCal,但尝试设置标头以强制重新验证。

<?php
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

您是否尝试添加"无缓存"标头?

<?php
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); //date in the past
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); //tell it we just updated
header( 'Cache-Control: no-store, no-cache, must-revalidate' ); //force revaidation
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' ); 
?>