我正在尝试按新日期递增日期。但它没有显示任何结果。
$ed = strtotime($endDate);
for ($i = $ed; $i <= strtotime($today); $i = $ed) {
$toArray['d'] = $ed;
$startDate = date('y-m-d', strtotime("+1 day", strtotime($endDate)));
$endDate = date('y-m-d', strtotime("+13 day", strtotime($startDate)));
$ed = strtotime($endDate);
}
它不起作用。
什么错了..?
答案 0 :(得分:1)
$endDate='2017-06-21';
$endDate='2017-05-05';
$ed = strtotime($endDate);
for($i = $ed; $i >= strtotime($today); $i = $ed ){
$toArray['d'] = $ed;
$startDate = date('y-m-d', strtotime("+1 day", strtotime($endDate)));
$endDate = date('y-m-d', strtotime("+13 day", strtotime($startDate)));
$ed = strtotime($endDate);
}