很抱歉发布这篇文章,但我已经挣扎了8天,真的希望有人能像我一样帮助我。我有json.html&xxjson-events.php在同一目录中,两个文件的内容都发布在下面。
json.html
<script type="text/javascript">
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
eventSources: [
// your event source
{
url: '/xxjson-events.php' // use the `url` property
}
]
});
</script>
xxjson-events.php
<?php
mysql_select_db($database_ghl_portal, $ghl_portal);
$query_rsXXCal = "SELECT * FROM events";
$rsXXCal = mysql_query($query_rsXXCal, $ghl_portal) or die(mysql_error());
$row_rsXXCal = mysql_fetch_assoc($rsXXCal);
$totalRows_rsXXCal = mysql_num_rows($rsXXCal);mysql_select_db($database_ghl_portal, $ghl_portal);
$query_rsXXCal = "SELECT * FROM events";
$rsXXCal = mysql_query($query_rsXXCal, $ghl_portal) or die(mysql_error());
$row_rsXXCal = mysql_fetch_assoc($rsXXCal);
$totalRows_rsXXCal = mysql_num_rows($rsXXCal);
$result = mysql_query($query_rsXXCal) or die(mysql_error());
while($row = mysql_fetch_assoc($result)){
$eventsArray = array();
$eventsArray['title'] = $row['title'];
$eventsArray['start'] = $row['start_date'];
$eventsArray['end'] = $row['end_date'];
}
echo json_encode($eventsArray)
?>
json-events.php在浏览器中查看显示:
{"title":"TEST","start":"2012-02-23 00:00:00","end":"2012-02-24 00:00:00"}
日历显示在页面上,但数据没有进入日历?有人知道为什么会这样吗?请,真的很难解决这个问题,需要排序。我以为可能是显示00:00:00的日期时间戳,但没有成功地更改了它?
如果它对任何人都有帮助,我上传了一个包含3个文件的zip,看看它是否对其他人有效?http://ghldatastream.co.uk.predns.ourwindowsnetwork.com/fullcal_json.zip
感谢
您的开始和结束日期必须是IETF、ISO8601或UNIX时间戳格式-请参阅http://arshaw.com/fullcalendar/docs/event_data/Event_Object/