如何使用fullcalendar.io重复每年的生日?

wmtdaxz3  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(407)

我正在使用fullcalendar.io插件开发一个系统。
我有一个表单,用户必须输入他们的生日并存储在数据库mysql中。表单工作,并且使用“date”类型成功地将日期存储在数据库中。那么如何让生日在日历上每年重复一次呢? calendarload.phpforeach($result as $res){$date=date('d/F/Y', strtotime($res['birthday'])); $data[] = array( 'title' => $res["name"], 'start' => $res['birthday'], 'bday' => $date ); }index.php ```
eventRender: function(event, element) {
element.append("" + event.bday + "");
},

我更喜欢使用mysqli而不是pdo。
polhcujo

polhcujo1#

我终于解决了!
我只是把日期分为$天、$月和$年。
这是我的代码,适用于我的案子。

foreach($result as $res){
$date1=date('d-F-Y', strtotime($res['birthday']));
$date=strtotime($res['birthday']);
$time  = $date;
$day   = date('d',$time);
$month = date('m',$time);
$year  = date('Y',$time);
$curryear = date('Y');

$data[] = array(
    'title'   => $res["name"], 
    'start'   => $curryear . "-" . $month . "-" . $day,
    'bday'   => $date1
);}

所以每当电脑每年都在变化。。生日将是一样的,因为我改为$curryear。

相关问题