【发布时间】:2011-09-11 00:53:39
【问题描述】:
好的,我一直在绞尽脑汁尝试从 mysql 构建 JSON 数组。数组必须采用以下格式。我正在使用 fullcalendar 并希望使日历上的事件动态化。下面是构建数组的代码,但是目前没有从mysql获取信息
$year = date('Y');
$month = date('m');
echo json_encode(array(
//Each array below must be pulled from database
//1st record
array(
'id' => 111,
'title' => "Event1",
'start' => "$year-$month-10",
'url' => "http://yahoo.com/"
),
//2nd record
array(
'id' => 222,
'title' => "Event2",
'start' => "$year-$month-20",
'end' => "$year-$month-22",
'url' => "http://yahoo.com/"
)
));
【问题讨论】: