마감일이 지나면 a태그가 없어지게 하려하는데
Copy
<?php
$today = date("Y-m-d H:i:s");
$magam = date("Y-m-d H:i:s", strtotime("$row[ct_time] +1 year"));
if ($today >= $magam) {
$tag = "";
}
if ($opt['ct_status'] == "완료") {
$tag = "<a href='download.php'> DOWN</a>";
} else {
$tag = "";
}
?>
<td headers="th_itsd" class="td_dvr"><?= $tag ?></td>
이렇게 짜는게 맞는지 궁금합니다
그리고 날짜는 >= 를써도 되는지요...
답변 3개
채택된 답변
+20 포인트
Copy
<?php
$today = date("Ymd");
$magam = date("Ymd", strtotime("$row[ct_time] +1 year"));
if ((int)$today < (int)$magam && $opt['ct_status'] == "완료") {
$tag = "<a href='download.php'> DOWN</a>";
}else{
$tag = "";
}
?>
<td headers="th_itsd" class="td_dvr"><?= $tag ?></td>
Copy
if ($opt['ct_status'] == "완료") {
$tag = "<a href='download.php?id=$od_id&iid={$row['it_id']}'> DOWN</a>";
}else if ($today >= $magam) {
$tag = "";
}
else {
$tag = "";
}
이렇게하고
테스트로
Copy
else if($today <= $magam){
$tag = "";
}
를 해봣는데 a태그가 생기네요 ㅠㅠ
답변을 작성하려면 로그인이 필요합니다.