Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何显示数据库中的数据以在完整日历上显示?_Php_Mysql_Codeigniter - Fatal编程技术网

Php 如何显示数据库中的数据以在完整日历上显示?

Php 如何显示数据库中的数据以在完整日历上显示?,php,mysql,codeigniter,Php,Mysql,Codeigniter,我试图显示数据库中的数据以在fullcalendar中显示,但数据不会显示在fullcalendar中,我曾尝试在几个集成了此功能的web教程中查看参考资料,但仍然无法正常工作 我的推荐人: 我有以下数据 [{"title": "Work", "start": "2019-08-01", "end": "2019-08-01" },{"title": "Work", "start": "2019-08-02","end": "2019-08-02"}] 这是我的js document.a

我试图显示数据库中的数据以在fullcalendar中显示,但数据不会显示在fullcalendar中,我曾尝试在几个集成了此功能的web教程中查看参考资料,但仍然无法正常工作

我的推荐人:

  • 我有以下数据

    [{"title": "Work", "start": "2019-08-01", "end": "2019-08-01" },{"title": "Work", "start": "2019-08-02","end": "2019-08-02"}]
    
    这是我的js

    document.addEventListener('DOMContentLoaded', function() {
      var calendarEl = document.getElementById('calendar');
      var calendar = new FullCalendar.Calendar(calendarEl, {
        plugins: [ 'dayGrid' ],
        height: 440,
        editable: true,
        eventSources: [
          {
            color: '#306EFE',   
            textColor: '#ffffff',
            events: "<?= base_url('UserDashboard/getAbsen'); ?>"
            // events: [{
            //   title: 'My Big Event',
            //   start: '2019-12-09',
            //   end: '2019-12-10'
            // },
            // {
            //   title: 'My Second Big Event',
            //   start: '2019-12-11',
            //   end: '2019-12-13'
            // },
            // {
            //   title: 'My Second Big Event',
            //   start: '2019-11-11',
            //   end: '2019-11-13'
            // },]
          }
        ]
      });
      calendar.render();
    });
    
    这是我的完整日历,数据不显示

    故障在哪里?

    有几种方法可以指定事件的JSON提要

    最简单的选择就是:

    events: '/myfeed.php'
    
    或者,如果还想指定一些选项,可以使用扩展表单:

    eventSources: [
    {
        url: '/myfeed.php',
        color: 'yellow',
        textColor: 'black'
    }
    
    您的代码不使用这两种格式中的任何一种—您有
    eventSources
    ,但没有
    url
    ,并且有
    事件

    按如下方式更新您的代码:

    eventSources: [{
        color: '#306EFE',   
        textColor: '#ffffff',
        url: "<?= base_url('UserDashboard/getAbsen'); ?>"
    }]
    
    eventSources:[{
    颜色:“#306EFE”,
    textColor:“#ffffff”,
    网址:“
    }]
    

    您的其余代码工作正常。

    我的答案有帮助吗?
    eventSources: [{
        color: '#306EFE',   
        textColor: '#ffffff',
        url: "<?= base_url('UserDashboard/getAbsen'); ?>"
    }]