代码生成JSON但不填充日历

时间:2017-11-11 15:59:52

标签: php json fullcalendar

我正在尝试从数据库中检索项目,然后将它们加载到fullcalendar

任何人都可以解释为什么这段代码会闪现原始JSON,然后解析它但不填充日历?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<?php
$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
if($conn)
{        
    header('Content-Type: application/json');
    $sql = "SELECT id, start, end, title FROM events";
    $result = $conn->query($sql);
    while($row = $result->fetch_assoc())
        {
            $events[] = $row; 
        }
    echo json_encode($events);
    exit;
}
?>

0 个答案:

没有答案