你需要读或写? 读我在过去使用:
http://sevengoslings.net/icalendar
和
http://www.phpclasses.org/browse/file/16660.html
http://sourceforge.net/projects/phpicalendar/ - <我相信这其中也可以读,但它是巨大的 - 你可能只需要一个功能或从那里两个
但我明白你的问题,你需要阅读 - iCalender是纯文本。 您只需要打开文件并逐行绘制。
<?php
$data = file_get_contents("myfile.ics"); //read the file
$convert = explode("\n", $data); //create array separate by new line
for ($i=0;$i<count($convert);$i++)
{
echo $convert[$i].', '; //write value by index
}
?>
,然后使用正则表达式或别的东西,给人类readeble格式标签..
编辑我:
我刚刚发现我使用的函数之前:它使用 这个课程:http://www.kigkonsult.se/iCalcreator/index.php 这不是我写的,但它在过去对我有效。 我不记得这个功能的源 - 如果我会找到它我会后..
<?php
require_once 'iCalcreator/iCalcreator.class.php';
$filename = 'D:\Document\Docs\2007\05\iCal-20070508-082112.ics';
$v = new vcalendar(); // initiate new CALENDAR
$v->parse($filename);
# get first vevent
$comp = $v->getComponent("VEVENT");
#print_r($comp);
$summary_array = $comp->getProperty("summary", 1, TRUE);
echo "summary: ", $summary_array["value"], "\n";
$dtstart_array = $comp->getProperty("dtstart", 1, TRUE);
$dtstart = $dtstart_array["value"];
$startDate = "{$dtstart["year"]}-{$dtstart["month"]}-{$dtstart["day"]}";
$startTime = "{$dtstart["hour"]}:{$dtstart["min"]}:{$dtstart["sec"]}";
$dtend_array = $comp->getProperty("dtend", 1, TRUE);
$dtend = $dtend_array["value"];
$endDate = "{$dtend["year"]}-{$dtend["month"]}-{$dtend["day"]}";
$endTime = "{$dtend["hour"]}:{$dtend["min"]}:{$dtend["sec"]}";
echo "start: ", $startDate,"T",$startTime, "\n";
echo "end: ", $endDate,"T",$endTime, "\n";
?>
如何下载它,因为下载(http://code.google.com/p/ics -parser/downloads/list)它只是说'这个项目目前没有下载。'? – 2012-03-11 12:34:07
点击此处的文件:http://code.google.com/p/ics-parser/source/browse/#svn%2Ftrunk - 然后选择'查看原始文件' – 472084 2012-03-11 12:55:24
谢谢。我有它的工作,它看起来非常好,但我怎么能改变它只显示它被访问的一天(今天)发生的事情? (我把我已经得到的问题,因为它太大,不能放在这里) – 2012-03-11 13:05:17