此脚本时,页面最后修订和产出作为二十分钟前,或XX天前的日期...或者即使您不更新太多 - 二十周前显示!
//File Name
$last_modified = filemtime("FILE.php");
{
$timediff = time() - $last_modified;
if ($timediff
{
if ($timediff
{
$returndate = "1 minute ago.";
}
else
{
$returndate = intval($timediff / 60) . " minutes ago.";
}
}
else if ($timediff
{
$returndate = "1 hour ago.";
}
else if ($timediff
{
$returndate = intval($timediff / 3600) . " hours ago.";
}
else if ($timediff
{
$returndate = "1 day ago.";
}
else if ($timediff
{
$returndate = intval($timediff / 86400) . " days ago.";
}
else if ($timediff
{
$returndate = "1 week ago.";
}
else if ($timediff
{
$returndate = intval($timediff / 604900) . " weeks ago.";
}
else
{
$returndate = @date('n-j-Y', $timestamp);
if($type=="fulldate")
{
$returndate = @date('n-j-y, H:i', $timestamp);
}
else if ($type=="time")
{
$returndate = @date('H:i', $timestamp);
}
}
//Display It
print("Last Modified: ");
print($returndate);
}
?>
它应该很容易理解。
$ last_modified = filemtime(“FILE.php”); - 更改FILE.php到文件您要连接。