通过json feed添加事件fullcalendar

I am newbie in yii and fullcalendar, i have - events.php:`

    try {
        $events = array();

        $query  = Yii::app()->db->createCommand("SELECT schedules.start_at, schedules.end_at, timetables.name,terminals.name FROM schedules, terminals, timetables WHERE schedules.terminal_id = terminals.id and timetables.id = schedules.timetable_id");
        $rows = $query->queryAll();
        foreach($rows as $row){
            $e = array();
            $e['title'] = $row['name'];
            $e['start'] = $row['start_at'];
            // Merge the event array into the return array
            array_push($events, $e);
        }
        echo json_encode($events);
        exit();

    } catch (PDOException $e) {
        print "Error!";
    }
    Yii::app()->end();
}
?>`

I can feed json from events.php in class calendar.php

events:
      {
        url:'events.php'
      }

Please help me how to call json "url:" by yii.

1个回答



你提出这样的请求</ p>


/index.php/events / getevents?id = 3 </ p>
</ blockquote>

(或者像/ getevents / id / 3),您将获得一个JSON格式的响应,如下所示:</ p>

  {“id”:“3”,“name”:“something”,“start_at”:“05/11/2016 10:00:00”} 
</ code> </ pre>

现在你有一个真正简单的JSON API </ p>
</ div>

展开原文

原文

you make a request like this

/index.php/events/getevents?id=3

(or like /getevents/id/3), you will get back a JSON formatted response, like this:

{"id":"3","name":"something","start_at":"05/11/2016 10:00:00"}

And now you have a real simple JSON API

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问