【问题标题】:fullCalendar json with php in "agendaWeek"“agendaWeek”中带有 php 的 fullCalendar json
【发布时间】:2011-01-30 14:54:41
【问题描述】:
<link rel='stylesheet' type='text/css' href='fullcalendar/redmond/theme.css' />
<link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar.css' />
<script type='text/javascript' src='fullcalendar/jquery/jquery.js'></script>
<script type='text/javascript' src='fullcalendar/jquery/ui.core.js'></script>
<script type='text/javascript' src='fullcalendar/jquery/ui.draggable.js'></script>
<script type='text/javascript' src='fullcalendar/jquery/ui.resizable.js'></script>
<script type='text/javascript' src='fullcalendar/fullcalendar.min.js'></script>

<script type='text/javascript'>

 $(document).ready(function() {

  $('#calendar').fullCalendar({

   theme: true,
   editable: false,
   weekends: false,
   allDaySlot: false,
   allDayDefault: false,
   slotMinutes: 15,
   firstHour: 8,
   minTime: 8,
   maxTime: 17,
   height: 600,
   defaultView: 'agendaWeek',

   events: "json_events.php",

   loading: function(bool) {
    if (bool) $('#loading').show();
    else $('#loading').hide();
   }

  });

 });

</script>

但信息不会出现在“议程周”上。 谁能告诉我我做错了什么。

我的“json_events.php”代码是:

<?php

 $year = date('Y');
 $month = date('m');

 echo json_encode(array(

  array(
   'id' => 111,
   'title' => "Event1",
   'start' => "$year-$month-22 8:00",
   'end' => "$year-$month-22 12:00",
   'url' => "http://yahoo.com/"
  ),

  array(
   'id' => 222,
   'title' => "Event2",
   'start' => "$year-$month-22 14:00",
   'end' => "$year-$month-22 16:00",
   'url' => "http://yahoo.com/"
  )

 ));

?>

它提出了以下内容:

[{"id":111,"title":"Event1","start":"2010-03-22 8:00","end":"2010-03-22 12:00","url":"http:\/\/yahoo.com\/"},{"id":222,"title":"Event2","start":"2010-03-22 14:00","end":"2010-03-22 16:00","url":"http:\/\/yahoo.com\/"}]

请如果有人可以帮助或建议某人帮助我。

谢谢, 丹尼斯

【问题讨论】:

    标签: jquery xml json date fullcalendar


    【解决方案1】:

    您需要将allDay指定为false,例如:

    [
        {
            "id": 111,
            "title": "Event1",
            "start": "2010-03-22 08:00",
            "end": "2010-03-22 12:00",
            "url": "http://yahoo.com/",
            "allDay": false
        },
        {
            "id": 222,
            "title": "Event2",
            "start": "2010-03-22 14:00",
            "end": "2010-03-22 16:00",
            "url": "http://yahoo.com/",
            "allDay": false
        }
    ]
    

    见:Integrating jQuery fullcalendar into PHP website

    【讨论】:

      【解决方案2】:

      将事件的“allDay”属性设置为空字符串。 (设置为 false 不起作用。)

      见:Integrating jQuery fullcalendar into PHP website

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-09-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-26
        • 2018-07-04
        相关资源
        最近更新 更多