我有一个编辑按钮供用户编辑他们发布的作业。我希望该按钮在发布后的一周内禁用或消失。我可以在php中执行此操作。谢谢你...
答案 0 :(得分: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";
}
?>