Fullcalendar 如何从 PHP 加载 BusinessHours

Fullcalendar how load BusinessHours from PHP

当我尝试从 php
加载我的 businessHours 时 我得到


但是当我在 businessHours 中手动粘贴时 PHP 返回的 JSON 它工作正常。


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

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

PHP 页面 return 编码为 JSON 的数组。