DateTime 不能用=来复制


$date1 = new DateTime();
$date2 = new DateTime();
$date2->add(new DateInterval('P3Y'));
This seems pretty damn obvious, so if I'm just not understanding, let me know.
Update:
If you want to copy rather than reference an existing DT object, use clone, not =.
$a = clone $b;

评论

热门博文