1. <legend id='28lmE'><style id='28lmE'><dir id='28lmE'><q id='28lmE'></q></dir></style></legend>

    2. <small id='28lmE'></small><noframes id='28lmE'>

    3. <tfoot id='28lmE'></tfoot>
      • <bdo id='28lmE'></bdo><ul id='28lmE'></ul>

      <i id='28lmE'><tr id='28lmE'><dt id='28lmE'><q id='28lmE'><span id='28lmE'><b id='28lmE'><form id='28lmE'><ins id='28lmE'></ins><ul id='28lmE'></ul><sub id='28lmE'></sub></form><legend id='28lmE'></legend><bdo id='28lmE'><pre id='28lmE'><center id='28lmE'></center></pre></bdo></b><th id='28lmE'></th></span></q></dt></tr></i><div id='28lmE'><tfoot id='28lmE'></tfoot><dl id='28lmE'><fieldset id='28lmE'></fieldset></dl></div>

      如何使用 PHP 动态发布 ical 文件以供 Google 日历读取?

      时间:2023-12-01
      <legend id='NwB5H'><style id='NwB5H'><dir id='NwB5H'><q id='NwB5H'></q></dir></style></legend>
          <tbody id='NwB5H'></tbody>

        <small id='NwB5H'></small><noframes id='NwB5H'>

      • <i id='NwB5H'><tr id='NwB5H'><dt id='NwB5H'><q id='NwB5H'><span id='NwB5H'><b id='NwB5H'><form id='NwB5H'><ins id='NwB5H'></ins><ul id='NwB5H'></ul><sub id='NwB5H'></sub></form><legend id='NwB5H'></legend><bdo id='NwB5H'><pre id='NwB5H'><center id='NwB5H'></center></pre></bdo></b><th id='NwB5H'></th></span></q></dt></tr></i><div id='NwB5H'><tfoot id='NwB5H'></tfoot><dl id='NwB5H'><fieldset id='NwB5H'></fieldset></dl></div>

            <bdo id='NwB5H'></bdo><ul id='NwB5H'></ul>

                <tfoot id='NwB5H'></tfoot>
                本文介绍了如何使用 PHP 动态发布 ical 文件以供 Google 日历读取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在 PHP ical 上的任何 Google 搜索都会显示 phpicalendar 以及如何解析或读取 IN ical 文件.我只想编写一个 PHP 文件,从我的数据库中提取事件并以 ical 格式写出.

                Any Google search on PHP ical just brings up phpicalendar and how to parse or read IN ical files. I just want to write a PHP file that pulls events from my database and writes them out in ical format.

                我的问题是我找不到可以回答两个问题的地方:

                My problem is I can't find anywhere that will answer two questions:

                1. 确切格式是什么,包括页眉、文件格式、页脚等?换句话说,该文件究竟必须具备什么才能被 Google 日历等正确读取?
                2. 如果我使用 .php 扩展名构建此文件,如何将其发布为 ical?我必须写入新的 .ics 文件吗?或者只要内容格式正确,Google Calendar 等是否会读取 .php 文件?(很像 style.css.php 文件如果内容实际上是 CSS 等,则会被读取为 CSS 文件等)
                1. What is the exact ical format, including headers, file format, footers, etc.? In other words, what does the file have to have, exactly, in order to be properly read in by Google Calendar, etc.?
                2. If I build this file using a .php extension, how do I publish it as ical? Do I have to write to a new .ics file? Or will Google Calendar etc. read a .php file as ical so long as the contents are in the correct format? (Much like a style.css.php file will be read as a CSS file if the contents are actually CSS, etc.)

                大家可以给予或指点我的任何帮助将不胜感激!!!

                Any help you all can give or point me to will be greatly appreciated!!!

                推荐答案

                如果 Google Calendar 不需要 *.ics-extension(这将需要在服务器).

                This should be very simple if Google Calendar does not require the *.ics-extension (which will require some URL rewriting in the server).

                $ical = "BEGIN:VCALENDAR
                VERSION:2.0
                PRODID:-//hacksw/handcal//NONSGML v1.0//EN
                BEGIN:VEVENT
                UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test
                DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
                DTSTART:19970714T170000Z
                DTEND:19970715T035959Z
                SUMMARY:Bastille Day Party
                END:VEVENT
                END:VCALENDAR";
                
                //set correct content-type-header
                header('Content-type: text/calendar; charset=utf-8');
                header('Content-Disposition: inline; filename=calendar.ics');
                echo $ical;
                exit;
                

                这基本上就是让客户认为您正在提供 iCalendar 文件所需的全部内容,即使在缓存、文本编码等方面可能存在一些问题.但是您可以开始尝试这个简单的代码.

                That's essentially all you need to make a client think that you're serving a iCalendar file, even though there might be some issues regarding caching, text encoding and so on. But you can start experimenting with this simple code.

                这篇关于如何使用 PHP 动态发布 ical 文件以供 Google 日历读取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:jQuery 插件实时更新 &lt;li&gt;来自 PHP 下一篇:如何使用php获取假期日期

                相关文章

                  <i id='RIFeb'><tr id='RIFeb'><dt id='RIFeb'><q id='RIFeb'><span id='RIFeb'><b id='RIFeb'><form id='RIFeb'><ins id='RIFeb'></ins><ul id='RIFeb'></ul><sub id='RIFeb'></sub></form><legend id='RIFeb'></legend><bdo id='RIFeb'><pre id='RIFeb'><center id='RIFeb'></center></pre></bdo></b><th id='RIFeb'></th></span></q></dt></tr></i><div id='RIFeb'><tfoot id='RIFeb'></tfoot><dl id='RIFeb'><fieldset id='RIFeb'></fieldset></dl></div>
                  <legend id='RIFeb'><style id='RIFeb'><dir id='RIFeb'><q id='RIFeb'></q></dir></style></legend>

                  <tfoot id='RIFeb'></tfoot>

                  <small id='RIFeb'></small><noframes id='RIFeb'>

                  • <bdo id='RIFeb'></bdo><ul id='RIFeb'></ul>