Php 如何将包含多个事件的ICS文件导入多个日历?

Php 如何将包含多个事件的ICS文件导入多个日历?,php,icalendar,Php,Icalendar,生成ICS文件后,当我转到导入Outlook/Google时,我发现只有一个事件在addbyURL时被导入。即使使用Import选项,它也会在导入的9个事件中给出一条消息1 在检查了多个链接、iCalendar规范之后,我很清楚,这方面的文档非常稀少。另外,到目前为止,没有人能够回答这类问题。有“类似”的问题,尽管没有一个对我和其他许多人有效 代码 PHP 生成的ICS(iCalendar)文件如下所示: BEGIN:VCALENDAR VERSION:2.0 PRODID:-//ZConten

生成ICS文件后,当我转到导入Outlook/Google时,我发现只有一个事件在
addbyURL
时被导入。即使使用
Import
选项,它也会在导入的9个事件中给出一条消息
1

在检查了多个链接、iCalendar规范之后,我很清楚,这方面的文档非常稀少。另外,到目前为止,没有人能够回答这类问题。有“类似”的问题,尽管没有一个对我和其他许多人有效

代码 PHP 生成的ICS(iCalendar)文件如下所示:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ZContent.net//ZapCalLib 1.0//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
SUMMARY:Car loan Payment
DTSTART:20181122T090000
DURATION:PT24H
UID:event1542634898@Company.org
Description:
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
BEGIN:VEVENT
SUMMARY:Bernie's Anniversary 
DTSTART:20181117T160000
DTEND:20181117T180000
UID:event1542634898@Company.org
Description:A small gathering to celebrate Bernie's 10 successful years at 
the company!
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
BEGIN:VEVENT
SUMMARY:Snow day
DTSTART:20181115T050000
DURATION:PT24H
UID:event1542634898@Company.org
Description:Snow all day!
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
BEGIN:VEVENT
SUMMARY:Gary's Bday
DTSTART:20181127T170000
DTEND:20181127T190000
UID:event1542634898@Company.org
Description:A small celebration for Gary's Birthday 
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
BEGIN:VEVENT
SUMMARY:Avengers Movie night
DTSTART:20181115T180000
DURATION:PT24H
UID:event1542634898@Company.org
Description:Watch avengers movie for free tonight!
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
BEGIN:VEVENT
SUMMARY:Electric Bill Payment
DTSTART:20181118T070000
DURATION:PT24H
UID:event1542634898@Company.org
Description:Please make a payment of $50 towards this month's bill!
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
BEGIN:VEVENT
SUMMARY:Gas Bill Payment
DTSTART:20181118T080000
DURATION:PT24H
UID:event1542634898@Company.org
Description:Please make a payment of $150 towards the current gas bill!
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
BEGIN:VEVENT
SUMMARY:Snow day
DTSTART:20181128T060000
DURATION:PT24H
UID:event1542634898@Company.org
Description:A winter storm warning is in effect and DG will remain closed f
or the day
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
BEGIN:VEVENT
SUMMARY:Thanksgiving Lunch
DTSTART:20181123T120000
DTEND:20181123T140000
UID:event1542634898@Company.org
Description:Please gather for free food friday\, where you can enjoy turkey
  and salad!
METHOD:PUBLISH
X-WR-CALNAME:CompanyCalendar
X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
SEQUENCE:0
CLASS:PUBLIC
DTSTAMP:20181119T134138
LAST-MODIFIED:20181119T134138
END:VEVENT
END:VCALENDAR
挑战
  • 未正确分析全天事件
  • 导入到其他日历无法正常工作
  • 文档太宽泛,示例太少
  • 图书馆对此的支持非常有限
  • 当单击打开windows 10日历中的同一ics文件并显示所有事件时,该文件工作正常(所有事件都已加载)。然而,正如前面多篇文章所提到的,时间仍然是关闭的,所有的一天事件都在第二天的12点结束,而不管24小时的持续时间是多少
  • 像Stanza.co这样的流行网站创建自己的日历,然后允许用户从所有其他日历订阅。这不是开源的

  • 我所研究的和你使用任何搜索栏都能找到的一样。围绕整个主题,我在多个网站上浏览了至少100篇或更多的文章。这是我第二次尝试得到答案。

    有错误。将您的ics文件通过各种ics验证器。我尽可能多地做,因为他们不会说同样的话。谷歌不会告诉你什么是错误的,但会拒绝无效的事件。使用一个验证器(此)和您的ics内容,我得到:

    问题!发现5个错误

    UID value is not unique, duplicate found near line # 6Reference: RFC 5545 3.8.4.7. Unique Identifier
    UID value is not unique, duplicate found near line # 20Reference: RFC 5545 3.8.4.7. Unique Identifier
    Missing DTSTAMP property near line # 35Reference: RFC 5545 3.6.1. Event Component
    Missing UID property near line # 35Reference: RFC 5545 3.6.1. Event Component
    Missing DTSTART property in VEVENT near line # 35Reference: RFC 5545 3.6.1. Event Component
    

    有错误。将您的ics文件通过各种ics验证器。我尽可能多地做,因为他们不会说同样的话。谷歌不会告诉你什么是错误的,但会拒绝无效的事件。使用一个验证器(此)和您的ics内容,我得到:

    问题!发现5个错误

    UID value is not unique, duplicate found near line # 6Reference: RFC 5545 3.8.4.7. Unique Identifier
    UID value is not unique, duplicate found near line # 20Reference: RFC 5545 3.8.4.7. Unique Identifier
    Missing DTSTAMP property near line # 35Reference: RFC 5545 3.6.1. Event Component
    Missing UID property near line # 35Reference: RFC 5545 3.6.1. Event Component
    Missing DTSTART property in VEVENT near line # 35Reference: RFC 5545 3.6.1. Event Component
    

    谢谢,这很合理,可以。我已经停止了这方面的开发,开始研究outlook和google日历API本身。Outlook MSGraph API似乎易于使用。我还不知道这是否适合我的项目。谢谢,这是合理的,可以。我已经停止了这方面的开发,开始研究outlook和google日历API本身。Outlook MSGraph API似乎易于使用。我还不知道这是否适合我的项目。
    BEGIN:VCALENDAR
    VERSION:2.0
    PRODID:-//ZContent.net//ZapCalLib 1.0//EN
    CALSCALE:GREGORIAN
    METHOD:PUBLISH
    BEGIN:VEVENT
    SUMMARY:Car loan Payment
    DTSTART:20181122T090000
    DURATION:PT24H
    UID:event1542634898@Company.org
    Description:
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Bernie's Anniversary 
    DTSTART:20181117T160000
    DTEND:20181117T180000
    UID:event1542634898@Company.org
    Description:A small gathering to celebrate Bernie's 10 successful years at 
    the company!
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Snow day
    DTSTART:20181115T050000
    DURATION:PT24H
    UID:event1542634898@Company.org
    Description:Snow all day!
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Gary's Bday
    DTSTART:20181127T170000
    DTEND:20181127T190000
    UID:event1542634898@Company.org
    Description:A small celebration for Gary's Birthday 
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Avengers Movie night
    DTSTART:20181115T180000
    DURATION:PT24H
    UID:event1542634898@Company.org
    Description:Watch avengers movie for free tonight!
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Electric Bill Payment
    DTSTART:20181118T070000
    DURATION:PT24H
    UID:event1542634898@Company.org
    Description:Please make a payment of $50 towards this month's bill!
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Gas Bill Payment
    DTSTART:20181118T080000
    DURATION:PT24H
    UID:event1542634898@Company.org
    Description:Please make a payment of $150 towards the current gas bill!
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Snow day
    DTSTART:20181128T060000
    DURATION:PT24H
    UID:event1542634898@Company.org
    Description:A winter storm warning is in effect and DG will remain closed f
    or the day
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:Thanksgiving Lunch
    DTSTART:20181123T120000
    DTEND:20181123T140000
    UID:event1542634898@Company.org
    Description:Please gather for free food friday\, where you can enjoy turkey
      and salad!
    METHOD:PUBLISH
    X-WR-CALNAME:CompanyCalendar
    X-WR-TIMEZONE:(GMT-05:00) Eastern Time (US & Canada)
    SEQUENCE:0
    CLASS:PUBLIC
    DTSTAMP:20181119T134138
    LAST-MODIFIED:20181119T134138
    END:VEVENT
    END:VCALENDAR
    
    UID value is not unique, duplicate found near line # 6Reference: RFC 5545 3.8.4.7. Unique Identifier
    UID value is not unique, duplicate found near line # 20Reference: RFC 5545 3.8.4.7. Unique Identifier
    Missing DTSTAMP property near line # 35Reference: RFC 5545 3.6.1. Event Component
    Missing UID property near line # 35Reference: RFC 5545 3.6.1. Event Component
    Missing DTSTART property in VEVENT near line # 35Reference: RFC 5545 3.6.1. Event Component