테스트 사이트 - 개발 중인 베타 버전입니다

구분자 /를 없애는게 가능할까요? 채택완료

소수리꼬 10년 전 조회 3,679

혹시 이런것도 가능할까요?

 

스킨에서 업뎃 파일에서요..

여기 고수님께서 알려주신 소스예요.. 월화수목금토일 앞에 있는 체크박스에  체크하면 무엇을 체크하였는지를 wr_1에 /를 구분자로해서 저장시킵니다..

 

$r_weekday = $_POST['rweekd']; // 선택된요일저장 끝 for($i=0;$i<$TMP_CNT;$i++){   $n = $r_weekday[$i];   switch($n){ case '1': $s="월"; break;            case '2': $s="화"; break;             case '3': $s="수"; break;             case '4': $s="목"; break;            case '5': $s="금"; break;            case '6': $s="토"; break;            case '0': $s="일"; break;  }    $t .= $s."/"; } // 선택된요일저장 끝​

 

저장방식문의좀 드릴께요...

1. 그러면 wr_1에는 일/월/화/수/목/금/토/ 이렇게 저장이 됩니다.. 근데요.. 마지막에  붙는 / . 즉, 토끝에 있는 /는 참 보기가 싫은데요.. 이걸 지우는 방법은 없을까요????

 

2. 그리고요 혹시... 일을 맨뒤로 보내어 저장할 순 없을까요? 왜냐면 주말을 선택하면 일/토/ 이렇게 나오자나요.. 일이 0이고 토가 6이니까요.. 근데 한국사람들은 보통 주말을 토/일이 더 와닿자나요... 그래서요.. 혹시나 이렇게 가능할지 여쭈어 봅니다. 

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트

</p><p><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">$r_weekday = $_POST['rweekd'];</span></p><p><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">// 선택된요일저장 끝</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">for($i=0;$i<$TMP_CNT;$i++){</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">  $n = $r_weekday[$i];</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">  switch($n){ case '1': $s="월"; break;</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">           case '2': $s="화"; break;</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">            case '3': $s="수"; break;</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">            case '4': $s="목"; break;</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">           case '5': $s="금"; break;</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">           case '6': $s="토"; break;</span><br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">           case '0': $s="일"; break;  }</span></p><p><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"></span>   if($i == ($TMP_CNT-1)){ // $i가 <span style="font-size: 13.3333330154419px; line-height: 1.5;">$TMP_CNT</span><span style="font-size: 10pt; line-height: 1.5;">​에서 1을 뺀거랑 같으면인데 조건이 작을때이니깐 마지막이에요.</span></p><p> </p><p>       $t .= $s;</p><p>   }else{<br style="background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">       $t .= $s."/";</span></p><p>   }<br style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);"><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">}</span></p><p><span style="font-family: gulim, helvetica; font-size: 13.0799999237061px; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">// 선택된요일저장 끝​</span> </p><p>

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

10년 전

</p><p>$n = array("일", "월", "화", "수", "목", "금", "토");
foreach($r_weekday as $v) $res[] = $n[$v];
$wr_1 = implode("/", $res);
echo $wr_1;</p><p>

 

배열로 넘어온다 생각하고 저런 식으로 바꿔 봤습니다.

체크박스에 value="1" 이런 걸 차라리 value="월" 이런 식으로 해서 넘기시면 코드가 한 줄로 끝날지도 모르겠네요. ㅎ 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

10년 전

우와 감사드려요... 그냥 포기하고 잇었는데 소스 주셔서 대단히 감사드립니다... 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인