/** * 解决2017-01-31 (-1 month)还显示1月的问题 */ $data = "2017-1-31"; $base = strtotime(date('Y-m',strtotime($data)) . '-01 00:00:01'); echo date('Y-m',strtotime('-1 month', $base));
php 解决date('Y-m',strtotime('-1 month'))
最新推荐文章于 2025-04-14 08:30:00 发布
/** * 解决2017-01-31 (-1 month)还显示1月的问题 */ $data = "2017-1-31"; $base = strtotime(date('Y-m',strtotime($data)) . '-01 00:00:01'); echo date('Y-m',strtotime('-1 month', $base));