Fullcalendar如何从PHP加载BusinessHours

时间:2019-10-10 21:34:43

标签: javascript php json fullcalendar

当我尝试从php加载businessHours时
我得到enter image description here


,但是当我在businessHours中手动粘贴时,PHP返回的JSON可以正常工作。
enter image description here


json是:

[ 
   { 
      "daysOfWeek":"[0]",
      "startTime":"09:00:00",
      "endTime":"19:00:00"
   },
   { 
      "daysOfWeek":"[1]",
      "startTime":"09:00:00",
      "endTime":"10:00:00"
   },
   { 
      "daysOfWeek":"[2]",
      "startTime":"09:00:00",
      "endTime":"10:00:00"
   },
   { 
      "daysOfWeek":"[3]",
      "startTime":"09:00:00",
      "endTime":"14:00:00"
   },
   { 
      "daysOfWeek":"[4]",
      "startTime":"09:00:00",
      "endTime":"14:00:00"
   },
   { 
      "daysOfWeek":"[5]",
      "startTime":"09:00:00",
      "endTime":"14:00:00"
   },
   { 
      "daysOfWeek":"[6]",
      "startTime":"09:00:00",
      "endTime":"19:00:00"
   }
]

我不知道怎么了。 我的JS代码是:businessHours: { url: 'classes/load-orariapertura.php' }
PHP代码为:https://pastebin.com/M9yL9DQn

1 个答案:

答案 0 :(得分:2)

解决了:businessHours: <?php include_once('classes/load-orariapertura.php'); ?>

PHP页面返回以JSON编码的数组。