我有这个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天’).