【问题标题】:Save Event in Google Calendar在 Google 日历中保存活动
【发布时间】:2017-11-04 23:54:52
【问题描述】:

您好,这个问题与this 有关,但这个问题将事件保存为 .ics 格式。我在想,当点击链接时,它会打开谷歌并自动保存,就像 下方的屏幕一样。因此,在我单击链接后,它类似于下图,它将我重定向到谷歌日历页面

【问题讨论】:

    标签: javascript php jquery laravel-5 icalendar


    【解决方案1】:

    试试这个:

    <?php
    $url = 'https://www.google.com/calendar/render?action=TEMPLATE&text={{ text }}&dates={{ start }}/{{ end }}&details={{ details }}&location={{ location }}&sf=true&output=xml';
    
    $event = [
        'text' => 'Your Event Name',
        'start' => date('Ymd\THis\Z', strtotime('today')),
        'end' => date('Ymd\THis\Z', strtotime('tomorrow')),
        'details' => 'Click here for more details: http://example.com',
        'location' => 'Waldorf Astoria, 301 Park Ave , New York, NY 10022'
    ];
    
    foreach ($event as $key => $value) {
        $url = str_replace("{{ $key }}", urlencode($value), $url);
    }
    
    echo $url;
    

    当您导航到生成的 URL 时,页面应该与屏幕截图中的一样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-08
      • 1970-01-01
      • 2017-10-15
      • 2023-04-04
      • 1970-01-01
      相关资源
      最近更新 更多