如何获得本月起的未来12个月?
如何获得本月起的未来12个月?
我现在用的是:
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
for($i=1;$i<=12;$i++){
$nextdate = date("Y-m",strtotime("+ $i month"));
echo '<p>'.$nextdate;
}
// 参数表示好多个月,你也可以修改为指定日期开始
function c($num = 12){
$temp = array();
$nowtime = strtotime( date('Y-m', time()) . '-1' );
while( $num>0 ){
$num--;
$nowtime = strtotime( '+1 month', $nowtime );
$temp[] = date('Y-m', $nowtime);
}
unset( $num, $nowtime );
return $temp;
}
print_r( c() ); <div class="clear"></div>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号