我是PHP的新生。我想创建3个函数来返回Today、Yesterday和Future。
有人能告诉我如何制作这些吗?
您可以使用以下函数:
// midnight second or equal today
function isToday($time)
{
return (strtotime($time) === strtotime('today'));
}
//Yesterday
function isPast($time)
{
return (strtotime($time) < time());
}
// Next day
function isFuture($time)
{
return (strtotime($time) > time());
}