-4

我有一个编辑按钮供用户编辑他们发布的工作。我希望该按钮在发布日后一周禁用或消失。如何在 php 中执行此操作。提前谢谢...

4

1 回答 1

1
<?php
    $timePublished = 1334301250; // unix time when job posted
    $afterOneWeek  = $timePublished+(60*60*24*7); // 1 week
    $dateNow       = date('U'); // unix time for Date Now
    if($dateNow > $afterOneWeek){ // if Date Now is greater than our "After One Week"
        echo "<button>Button is now visible</button>";
    } else {
        echo "No button, one week not passed";
    }
?>
于 2012-04-13T07:17:26.830 回答