PHP查看“最后发送”日期是否是30天前

我有这个PHP代码:

$last_sent=strtotime('2013-08-12');
if($last_sent < strtotime('now +30 days'))
{
    echo 'send survey';
}
else
{
    echo 'dont send survey';
}

我需要查看$last_sent日期是30天前还是30天以前.这似乎不起作用.

我将最后发送的日期更改为2013-07-12(正好是30天前)它回应发送调查,然后当我将日期更改为今天(2013-08-12)时,它仍然显示“发送调查”

解决方法:

而不是strtotime(‘现在30天’)使用strtotime(‘ – 30天’).

相关文章

文章浏览阅读8.4k次,点赞8次,收藏7次。SourceCodester Onl...
文章浏览阅读3.4k次,点赞46次,收藏51次。本文为大家介绍在...
文章浏览阅读1.1k次。- php是最优秀, 最原生的模板语言, 替代...
文章浏览阅读1.1k次,点赞18次,收藏15次。整理K8s网络相关笔...
文章浏览阅读1.2k次,点赞22次,收藏19次。此网络模型提供了...
文章浏览阅读1.1k次,点赞14次,收藏19次。当我们谈论网络安...