直接上代码 $card_id = "******19980313****"; // 有用的数据只有下标(6,10) echo date('Y') - substr($card_id, 6, 4) + (