doue9730 2016-05-08 07:20 采纳率: 100%
浏览 40

通过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条回答 默认 最新

  • drix47193 2016-05-10 22:11
    关注

    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

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料