7天后PHP删除记录?

PHP*_*VER 1 php unix datetime date unix-timestamp

我希望在7天或更早的时候删除数据库中的记录.我的服务器时间设置为英国时间,但出于某种原因,我在下面写的代码总是回显的帐户被删除为7天或更长时间,由于某种原因,它不起作用.在我测试我的测试数据库之前,我决定现在使用一个简单的回声,但正如我所说它不会起作用.

任何人有任何建议,为什么它不工作?我一定做错了什么.

<?php

// Get Current Time
$current_time = time();

/* The time i used below (unix) for testing is 
18-02-2011 14:34:24 (yesterdays date/time) */
$account_delete = strtotime(time('1298039664'));

if ($current_time - $account_delete >= (7*24*60*60)){
echo 'Account Deleted as 7 or more days old';
} else {
  echo 'Account Not Deleted as less than 7 days old';
}

?>
Run Code Online (Sandbox Code Playgroud)

小智 6

更换strtotime(time('1298039664'))1298039664

time()不带任何参数.