我正在尝试下面的代码..集成完整日历:-
<doctype! html>
<html lang="urf-8">
<head>
<title>Full calendar</title>
<link rel="stylesheet" href="fullcalendar.css"/>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css"/>
<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript' src='fullcalendar.js'></script>
<script>
$(document).ready(function() {
$('#cal').fullCalendar({
// put your options and callbacks here
theme: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay,agendaWeek,agendaDay'
},
editable: false,
events: "json-events.php",
})
});
</script>
</head>
<body>
<div id="cal" ></div>
</body>
</html>Json-events.php代码:-
<?php
include("connect.php");
$query = "select * from calendar";
$res = mysql_query($query) or die(mysql_error());
$events = array();
while ($row = mysql_fetch_assoc($res)) {
$eventsArray['id'] = $row['calendar_id'];
$eventsArray['title'] = $row['subject'];
$eventsArray['start'] = mktime($row['start_date_time']);
$events[] = $eventsArray;
}
echo json_encode($events);
?>为了进行调试,当我访问json-events.php时,我得到了结果,但在完整的日历中没有显示任何事件。
请帮帮我..
发布于 2012-11-25 14:08:08
问题出在JSON中日期字符串的格式。格式与插件的日期格式不兼容。如果你在php中使用strtotime()转换成UNIX时间戳,它们将会工作。
https://stackoverflow.com/questions/13537591
复制相似问题