,但是当我在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
答案 0 :(得分:2)
解决了:businessHours: <?php include_once('classes/load-orariapertura.php'); ?>
PHP页面返回以JSON编码的数组。