到目前为止,这只发生在 31 日
echo date('F',strtotime('this month')); //May
echo date('F',strtotime('next month'));//July
echo date('F',strtotime('+1 month'));//July
据我了解,六月是在五月之后。但我猜 php 很懒,从现在起只添加了 31 天,跳过了整整一个月。
无论长度如何,我如何才能安全地获得下个月?最好使用 strttotime
编辑忘了提及,为什么我希望使用 strtotime 是因为我使用搜索框来查找解释用户输入 strtotime 的事件
最佳答案
最可靠的方法可能是:
date('F', mktime(0, 0, 0, date('n') + 1, 1))
关于php - strtotime 'next month' 未按预期运行(即今天),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6182925/