php strtotime 求解释 $t 时间是1月31号 2月没有 所以数组第二个元素也是三月了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 二月没有 31 日 所以 一月31日加一个月就到三月了$t = '2011-01-28 17:21:22'; //改成 28 日print_r(array( date('Y年m月',strtotime($t)), date('Y年m月',strtotime('+ 1 month',strtotime($t))), date('Y年m月',strtotime('+ 2 month',strtotime($t))),));Array( [0] => 2011年01月 [1] => 2011年02月 [2] => 2011年03月)strtotime 是有自动校正日期的功能的print_r(array( date('Y年m月d日',strtotime('2011-02-31')), date('Y年m月d日',strtotime('2011-04-31')), date('Y年m月d日',strtotime('2011-06-31')),));Array( [0] => 2011年03月03日 [1] => 2011年05月01日 [2] => 2011年07月01日) php中使用ajax时ResponseText返回undefined PHP 创建windows下创建中间带有空格的文件名失败 php中为什么不能向一个指定的节点添加新的子节点? php采集问题 我要学php,能不能推荐点资料啊 php+access中文显示乱码 如何组装一个模版? 关于在smarty里面处理循环嵌套 5个三角了,散分,很开心喔 请教:如何去掉"\n"换行符 symfony2实现登录注册 文字输出至图片的排版问题
所以 一月31日加一个月就到三月了
$t = '2011-01-28 17:21:22'; //改成 28 日
print_r(array(
date('Y年m月',strtotime($t)),
date('Y年m月',strtotime('+ 1 month',strtotime($t))),
date('Y年m月',strtotime('+ 2 month',strtotime($t))),
));Array
(
[0] => 2011年01月
[1] => 2011年02月
[2] => 2011年03月
)strtotime 是有自动校正日期的功能的print_r(array(
date('Y年m月d日',strtotime('2011-02-31')),
date('Y年m月d日',strtotime('2011-04-31')),
date('Y年m月d日',strtotime('2011-06-31')),
));Array
(
[0] => 2011年03月03日
[1] => 2011年05月01日
[2] => 2011年07月01日
)