fullcalendar的正确JSON日期时间语法
需要一些关于在议程视图中显示事件时间的正确语法的帮助。尽管将allDay设置为false,但事件仅在all day下显示 我的json.html页面如下所示:fullcalendar的正确JSON日期时间语法,json,date,time,fullcalendar,Json,Date,Time,Fullcalendar,需要一些关于在议程视图中显示事件时间的正确语法的帮助。尽管将allDay设置为false,但事件仅在all day下显示 我的json.html页面如下所示: $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'm
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
eventSources: [
{
url: 'json-events.php', // use the `url` property
color: 'yellow', // an option!
textColor: 'black', // an option!
editable: false
},
// Dont forget coma - but not on the last one
{
url: 'other-events.php', // use the `url` property
color: 'red',
textColor: 'black',
editable: 'false',
allDay: 'false'
}
// any other sources...
]
});
});
<?php
echo json_encode(array(
array(
'id' => 112,
'title' => "What is this?",
'start' => "2011-10-11T13:00:00",
'end' => "2011-10-12T15:00:00",
'allDay' => "false"
),
));
?>
'allDay' => false
其中一个php页面如下所示:
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
eventSources: [
{
url: 'json-events.php', // use the `url` property
color: 'yellow', // an option!
textColor: 'black', // an option!
editable: false
},
// Dont forget coma - but not on the last one
{
url: 'other-events.php', // use the `url` property
color: 'red',
textColor: 'black',
editable: 'false',
allDay: 'false'
}
// any other sources...
]
});
});
<?php
echo json_encode(array(
array(
'id' => 112,
'title' => "What is this?",
'start' => "2011-10-11T13:00:00",
'end' => "2011-10-12T15:00:00",
'allDay' => "false"
),
));
?>
'allDay' => false
如何让事件以适当的时间显示在周和日代理视图中(而不是列在“全天”部分)
谢谢,
极端新手在调整代码后,我通过删除“”around false使其正常工作。php页面应如下所示:
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
eventSources: [
{
url: 'json-events.php', // use the `url` property
color: 'yellow', // an option!
textColor: 'black', // an option!
editable: false
},
// Dont forget coma - but not on the last one
{
url: 'other-events.php', // use the `url` property
color: 'red',
textColor: 'black',
editable: 'false',
allDay: 'false'
}
// any other sources...
]
});
});
<?php
echo json_encode(array(
array(
'id' => 112,
'title' => "What is this?",
'start' => "2011-10-11T13:00:00",
'end' => "2011-10-12T15:00:00",
'allDay' => "false"
),
));
?>
'allDay' => false
:)你需要去掉“false”的引号。“false”是一个字符串,false是正确的“bool”false 另外,json调用应该有一个查询,例如
$sql = mysql_query("query") or die(mysql_error());
后跟while语句以检索信息
while($arr = mysql_fetch_array($sql)){
$array_content[] = $arr;
}
然后编码
echo json_encode($array_content);
这将呈现数据库中的任何数据。
while语句中的一个简单if语句会将字符串更改为bool,如下所示
if($arr['allDay'] === "true"){
$arr['allDay'] = true;
} else {
$arr['allDay'] = false;
}
}
希望这有帮助