Php 始终显示当前年份直到下一个两年

Php 始终显示当前年份直到下一个两年,php,datepicker,Php,Datepicker,我认为这个问题很简单,但我仍然停留在这里。我想显示当前年份+未来两年。例如,如果现在是2013年,它将显示2013年、2014年、2015年;如果今年是2014年,它将显示2014年、2015年、2016年 这是我的代码 $myCalendar->setYearInterval(date('Y'), 2015); function setYearInterval($start, $end){ $this->year_start_input = $start;

我认为这个问题很简单,但我仍然停留在这里。我想显示当前年份+未来两年。例如,如果现在是2013年,它将显示2013年、2014年、2015年;如果今年是2014年,它将显示2014年、2015年、2016年

这是我的代码

$myCalendar->setYearInterval(date('Y'), 2015);

    function setYearInterval($start, $end){
    $this->year_start_input = $start;
    $this->year_end_input = $end;

    if(!$start) $start = $this->year_start;
    if(!$end) $end = $this->year_end;

    if($start < $end){
        $this->year_start = $start;
        $this->year_end = $end;
    }else{
        $this->year_start = $end;
        $this->year_end = $start;
    }
$myCalendar->setYearInterval(日期('Y'),2015年);
函数setYearInterval($start,$end){
$this->year\u start\u input=$start;
$this->year\u end\u input=$end;
如果(!$start)$start=$this->year\u start;
如果(!$end)$end=$this->year\u end;
如果($start<$end){
$this->year\u start=$start;
$this->year\u end=$end;
}否则{
$this->year\u start=$end;
$this->year\u end=$start;
}
我确实将2015年更改为+2/-2,但它显示为201120122013(当年+2年前)。请帮助。谢谢。

为什么不使用:

$myCalendar->setYearInverval(date('Y'), date('Y')+2);
假设您使用的是triconsole的日历日期选择器。

如果您确实使用上面提到的日历日期选择器,则应该这样做

$myCalendar->dateAllow(from, to, false)
如果从或为空,则可以选择之前或之后的所有日期。此处为False表示禁用其他日期。您可以将日期放在此处,例如,您可以禁用今天之前的所有日期。如果您想要完整的年份范围(而不是日期范围),也可以使用以下选项


我们可以看看
setYearInterval
函数中的代码是什么吗?没有像
setYearInterval()
这样的PHP核心函数。它来自哪里?您在这里使用的是哪个日历类?他很可能使用
$myCalendar->setYearInverval(date('Y'), date('Y')+2);