时间:2021-07-01 10:21:17 帮助过:25人阅读
$days=array();
for($i=0;$i<=7;$i++){//这里数字根据需要变动
$days[]=date("Y-m-d",strtotime('-'.$i.'day'));
}//http://www.scutephp.com/echo '
';print_r($days);结果将显示如下:
Array
(
[0] => 2014-03-21
[1] => 2014-03-20
[2] => 2014-03-19
[3] => 2014-03-18
[4] => 2014-03-17
[5] => 2014-03-16
[6] => 2014-03-15
[7] => 2014-03-14
)