我有两个变量是这样设置的:
<?php $current = strftime('%m/%d/%g %H:%M:%S')?>
<?php $target = strftime('%m/%d/%g %H:%M:%S', strtotime($item->getendtime()))?>
然后我有一个if语句,像这样:
<?php if ($current < $target): ?>
Do this
<?php else: ?>
Do that
<?php endif; ?>
在我们进入新的一年之前,一切都很好。例如,我有几个项目的"结束时间"是2012年。如果If语句正常工作,它应该是"DO THAT"而不是"DO THIS"
请使用以下格式(与unix时间戳比较):
$current = time();
$target = strtotime($item->getendtime());