$start_time='2006-06-04';
$day=substr($start_time,8,2);
$month=substr($start_time,5,2);
$year=substr($start_time,0,4);for ($i=0,$n=3;$i<$n;$i++)
{
echo date('Y-m-d',mktime(0,0,0,$month+=2,$day,$year));
echo "<br>";
}

解决方案 »

  1.   

    用strtotime("+ 2months")可以搞定
      

  2.   

    <?
    $str1 = "2006-07-01";
    $str2 = "2008-08-04";
    for($i = strtotime($str1);$i<=strtotime($str2);)
    {
    echo date("Y-m-d",$i);
    $ar =explode("-",date("Y-m-d",$i));
    $i = mktime(0,0,0,$ar[1]+2,$ar[2],$ar[0]);
    }?>
      

  3.   

    $str1 = "2006-02-04"; 
    $str2 = "2008-08-04"; 
    for($i = strtotime($str1);$i <=strtotime($str2);) 

    echo date("Y-m-d", $i=strtotime("2 months", $i)).'<br>'; 
    }
      

  4.   

    strtotime  手册上有个+1day 什么的,那要那么麻烦啊
    <?php
    echo strtotime("now"), "\n";
    echo strtotime("10 September 2000"), "\n";
    echo strtotime("+1 day"), "\n";
    echo strtotime("+1 week"), "\n";
    echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
    echo strtotime("next Thursday"), "\n";
    echo strtotime("last Monday"), "\n";
    ?> 
    只要循环输出就行了.