Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php strotime';第三天+;1个月';=假的_Php_Strtotime - Fatal编程技术网

php strotime';第三天+;1个月';=假的

php strotime';第三天+;1个月';=假的,php,strtotime,Php,Strtotime,我想要一个这样的循环: 此循环正常: while($d<=$d2) { $x = "first day of + 1 month"; $d=strtotime($x,$d); do_something($d); } while($d未指定一周中的某一天,只有第一天和最后一天使用“+x个月”。使用strotime只需使用两次。例如: $d1= strtotime('first day of + 1 month',$d)

我想要一个这样的循环:

此循环正常:

while($d<=$d2) {  
        $x = "first day of + 1 month";
        $d=strtotime($x,$d);
        do_something($d);
}

while($d未指定一周中的某一天,只有第一天和最后一天使用“+x个月”。使用strotime只需使用两次。例如:

$d1= strtotime('first day of + 1 month',$d);
$day = 3;
$dateStr = date("Y-m-",$d1).sprintf("%02d",$day);
$d = strtotime($dateStr);

谢谢,它在工作。
$d1= strtotime('first day of + 1 month',$d);
$day = 3;
$dateStr = date("Y-m-",$d1).sprintf("%02d",$day);
$d = strtotime($dateStr);