下面的代碼將增加/減少一週1: (是的,我的應用程序需要的值存儲在一個$_SESSION
if (isset($_POST['decrease'])) {
$week_value = ($_SESSION['sess_week'] = $_SESSION['sess_week']-1);
}
else if (isset($_POST['increase'])) {
$week_value = ($_SESSION['sess_week'] = $_SESSION['sess_week']+1);
}
else {
$week_value = ($_SESSION['sess_week'] = date('W'));
}
echo $week_value;
不過。我想在第52周(新的一年)重置,我該怎麼做?我是編程新手。
感謝大家的快速回復。我使用@xdazz代碼。它像一個魅力一樣工作! – David 2012-08-02 08:39:32