我想从PHP代码向outlook日历添加事件.由于outlook可以接受扩展名为“.ics”的文件,因此我尝试使用此示例代码生成一个ics文件:
原文链接:https://www.f2er.com/php/132662.html<?PHP header("Content-Type: text/Calendar"); header("Content-Disposition: inline; filename=calendar.ics"); echo "BEGIN:VCALENDAR\n"; echo "VERSION:2.0\n"; echo "PRODID:www.testMeiCalendar.net\n"; echo "METHOD:REQUEST\n"; // requied by Outlook echo "BEGIN:VEVENT\n"; echo "DTSTART:20101231T230000\n"; echo "DTEND:20110101T010000\n"; echo "SUMMARY:New Years Eve Reminder\n"; echo "LOCATION:Downtown\n"; echo "DESCRIPTION:Let's get together for New Years Eve\n"; echo "UID:ABCD1234\n"; echo "SEQUENCE:0\n"; echo "DTSTAMP:20101125T112600\n"; echo "END:VEVENT\n"; echo "END:VCALENDAR\n"; ?>
所以现在当我在Firefox中运行此代码时,我得到一个弹出窗口,要求使用Microsoft Outlook打开生成的ics文件,然后打开它并将其保存到Outlook,最后在Outlook中添加了一个事件.
但有没有办法让这个过程自动化?我的意思是,我可以直接从PHP脚本将事件存储在Outlook日历中,而无需生成ics文件并保存吗?