我有这样一个惊人的情况。我正在从 MySql(使用 Php)中检索数据并将其编码为 json 编码字符串以插入到 jQuery 完整日历中。让我们看看 PHP 脚本 =>
while ($birthday_row = $birthday_r->fetch_row()){
$birthday_array[] = array(
'id' => $birthday_row[0],
'title' => $birthday_row[1],
'start' => "2012-" . $birthday_row[2] . "-" . $birthday_row[3],
);
}
(从 MySql 检索数据时我没有错误,它工作正常)
然后用这样的json_encode
函数编码它=>
$k = json_encode($birthday_array);
并将其插入到 jQuery 完整日历中,这里是 JavaScript =>
jQuery("#calendar").fullCalendar({ // initialize full calendar
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
<?php
echo "events:" . $k . ",";
?>
eventMouseover: function(calEvent,jsEvent,view){
$(this).css("cursor","pointer");
}
});
我想知道的原因是,在 Chrome 中插入了数据,但在其他浏览器(如 firefox、opera、explorer、safari)中却没有。
顺便说一下,这里是$k
变量 =>的输出
[{"id":"1","title":"\u10d7\u10dd\u10e0\u10dc\u10d8\u10d9\u10d4 \u10dc\u10d0\u10dc\u10dd\u10d1\u10d0\u10e8\u10d5\u10d8\u10da\u10d8","start":"2012-10-2"},{"id":"2","title":"\u10d2\u10d8\u10dd\u10e0\u10d2\u10d8 \u10d9\u10d0\u10d9\u10d0\u10e8\u10d5\u10d8\u10da\u10d8","start":"2012-10-1"},{"id":"3","title":"\u10e0\u10e3\u10d7\u10d8 root","start":"2012-9-17"},{"id":"4","title":"one one","start":"2012-9-20"},{"id":"7","title":"\u10d2\u10d8\u10dd\u10e0\u10d2\u10d8 \u10d9\u10d0\u10d9\u10d0\u10e8\u10d5\u10d8\u10da\u10d8","start":"2012-9-5"},{"id":"8","title":"\u10d2\u10d8\u10dd\u10e0\u10d2\u10d8 \u10d0\u10e4\u10e0\u10d8\u10d0\u10e8\u10d5\u10d8\u10da\u10d8","start":"2012-1-16"}]
我不知道我做错了什么,但事实是结果让我想知道。请帮助任何想法!预先感谢