이 소스좀 분석해주실분 계신가요ㅠㅠ 각 줄마다 뭘 뜻하는지좀 제발 알려주세요ㅠ 채택완료
aaab
8년 전
조회 2,459
$msg = array();
if($board['bo_use_category']) {
$ca_name = trim($_POST['ca_name']);
if(!$ca_name) {
$msg[] = '분류를 선택하세요.';
} else {
$categories = array_map('trim', explode("|", $board['bo_category_list'].($is_admin ? '|공지' : '')));
if(!empty($categories) && !in_array($ca_name, $categories))
$msg[] = '분류를 올바르게 입력하세요.';
if(empty($categories))
$ca_name = '';
}
} else {
$ca_name = '';
}
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
8년 전
</p><p>// 배열선언</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">$msg = array();</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">// 게시판 설정에서 분류를 사용한다고 설정되어 있으면</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">if($board['bo_use_category']) {</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> // 검색조건에 분류명의 값의 공백을 지우고 그 값을 <span style="font-size: 14.004px;">$ca_name 할당</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"><span style="font-size: 14.004px;"> $ca_name = trim($_POST['ca_name']);</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">
</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> // 검색조건에 분류명이 없으면</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> if(!$ca_name) {</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> $msg[] = '<strong>분류</strong>를 선택하세요.';</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> } else {</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> // <span style="font-size: 14.004px;">게시판 설정에서 분류명을 | 문자로 나누어 </span><span style="font-size: 14.004px;">$categories 배열에 저장한다</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"><span style="font-size: 14.004px;"> // 만일 관리자라면 공지 라는 값을 </span><span style="font-size: 14.004px;">$categories 배열에 추가한다</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> $categories = array_map('trim', explode("|", $board['bo_category_list'].($is_admin ? '|공지' : '')));</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> // <span style="font-size: 14.004px;">$categories</span><span style="font-size: 14.004px;"> 배열에 값이 없거나 </span><span style="font-size: 14.004px;">$categories 배열안에 </span><span style="font-size: 14.004px;">$ca_name 이 포함되어 있지 않으면</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> if(!empty($categories) && !in_array($ca_name, $categories))</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> $msg[] = '분류를 올바르게 입력하세요.';</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> // <span style="font-size: 14.004px;">$categories</span><span style="font-size: 14.004px;"> 배열에 값이 없으면 </span><span style="font-size: 14.004px;">$ca_name 에 값이 있던지 없던지 무조건 </span><span style="font-size: 14.004px;">$ca_name 도 비움</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> if(empty($categories))</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> $ca_name = '';</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> }</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">} else {</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> // <span style="font-size: 14.004px;">게시판 설정에서 분류를 사용한다고 설정되어 있지 않으면서</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"><span style="font-size: 14.004px;"> // </span><span style="font-size: 14.004px;">$ca_name 에 값이 있던지 없던지 무조건 </span><span style="font-size: 14.004px;">$ca_name 을 비움</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;"> $ca_name = '';</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: Arial, 돋움, Dotum; font-size: 14.004px;">}</p><p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
그누보드 소스로 공부해 가면서 PHP 를 이해하려고 생각하신다면
잘못 생각하셨다에 백만스물한표와 500원을 겁니다
검색해 보시면 PHP 강좌 많이 있습니다
더불어 javascript, HTML, HTML5, CSS, SQL 도 공부하셔야 합니다
이 조건이 그누보드 소스를 이해하는 최소(!!!) 조건입니다