将JSON响应转换为PHP变量

I have a script (from GitHub) that uses the Google Calendar API to display upcoming events.

<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="format-google-calendar.js"></script>
<script>
  formatGoogleCalendar.init({
    calendarUrl: 'https://www.googleapis.com/calendar/v3/calendars/7aqribjvrco83j69ufindoig3g@group.calendar.google.com/events?key=AIzaSyDls1AFdCYUTxYRWpYNUiLwOarKao3WV_c',
    past: true,
    upcoming: true,
    sameDayTimes: true,
    pastTopN: 20,
    upcomingTopN: 3,
    itemsTagName: 'li',
    upcomingSelector: '#events-upcoming',
    pastSelector: '#events-past',
    upcomingHeading: '<h2>Upcoming events</h2>',
    pastHeading: '<h2>Past events</h2>',
    format: ['*date*', ': ', '*summary*', ' &mdash; ', '*description*', ' in ', '*location*']
  });

What I want to do is store different parts of the data in a PHP variable per event, for instance:

<?php 
   $date= JSON Date
   <--! For next event !-->
   $date2= JSON Date2
   $date3= JSON Date3
   ?>

I only need 3 as it will only be displaying 3 upcoming events.

查看全部
dsfdsfsdf45489
dsfdsfsdf45489
2016/10/05 08:40
  • json
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复