Home >php教程 >php手册 >php生成按指定时间以来的,年、季度、月份的下拉列表

php生成按指定时间以来的,年、季度、月份的下拉列表

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:23:352424browse

php教程生成按指定时间以来的,年、季度、月份的下拉列表

function countSeason($start,$end){
    $temp = date("Y-m",strtotime("$start +3month"));
    while ($temp         $time[] = $temp;
        $temp = date("Y-m",strtotime("$temp +3month"));
    }
    return $time;
}
$time = countSeason("2008-10",date("Y-m"));
?>


/*
直接循环
如果是月,则循环变量每次增加1(月)
如果是年,则每次增加12(月),
同时输出date('Y-m')或者 date('Y')

*/


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn