循环遍历js函数参数


Looping through js function parameter

我有下面的js.

$('#calendar').fullCalendar({
      header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
      },
      editable: false,

      events: [
        {
          title: 'Absent',
          start: new Date(y, m, 9),
          color: '#008aaf '
        }
      ]

    });
上面的js为我生成了一个日历。events参数在开始字段中指定的日期标记事件。现在我必须根据我的php 日期数组动态生成事件,如下所示:
   Array
    (
        [0] => 28/07/2014
        [1] => 30/07/2014
        [2] => 01/08/2014
        [3] => 29/07/2014
    )

如何生成事件基于php 日期数组?

这样怎么样?

$('#calendar').fullCalendar({
  header: {
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
  },
  editable: false,
  events: [
  <?php
    foreach($dateArray as $date)
    {
        $dateParts = explode("/",$date);
        $dates[] = "{
          title: 'Absent',
          start: new Date(".$dateParts[2].", ".$dateParts[1].", ".$dateParts[0]."),
          color: '#008aaf '
        }";
    }
    echo implode(",",$dates);
  ?>
  ]
});