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 日历读取?

      How can I use PHP to dynamically publish an ical file to be read by Google Calendar?(如何使用 PHP 动态发布 ical 文件以供 Google 日历读取?)
      <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 日历读取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <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>
                    <tbody id='RIFeb'></tbody>
                  <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>