$a = date('Y-m', strtotime('-1 month',strtotime('2020-10-31')));
        echo $a;      // 10
        exit;

但31天的时候,-1 month, 返回的月份就不是上个月了哦
相信坚持的力量,日复一日的习惯.