html 게시판 로딩 속도 채택완료
</p>
<p><?php</p>
<p>if ($board[bo_table] == 'about_1' ) include_once(G5_PATH.'/mobile/sub/about_1.php');</p>
<p>if ($board[bo_table] == 'about_2' ) include_once(G5_PATH.'/mobile/sub/about_2.php');</p>
<p>if ($board[bo_table] == 'about_4' ) include_once(G5_PATH.'/mobile/sub/about_4.php');</p>
<p>if ($board[bo_table] == 'about_5' ) include_once(G5_PATH.'/mobile/sub/about_5.php');</p>
<p>if ($board[bo_table] == 'about_6' ) include_once(G5_PATH.'/mobile/sub/about_6.php');</p>
<p>if ($board[bo_table] == 'about_7' ) include_once(G5_PATH.'/mobile/sub/about_7.php');</p>
<p>?></p>
<p>
html 게시판에서 내용을 불러올때 위와 같은 형식으로 짰습니다.
헌데 if를 계속 비교해야해서 뭔가 미세하게 느린 느낌입니다...
속도를 조금이나마 빠르게 하려면 어떻게 해야할까요??
답변 5개
bo_table과 파일명이 같다면 차라리 그냥 쓰시는 게 낫지 않나 싶네요.
include_once(G5_PATH."/mobile/sub/".$board['bo_table'].".php";
답변에 대한 댓글 3개
제가 그 말은 안 썼네요.
위에 올리신 조건문 모두 제거하시고 저 한 줄 넣으시면 돼요.
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
이 화면은 왕계란님 말씀처럼 처리하시면 될거 같습니다.
그런데 가장 크게 마음에 걸리는거는 저 if문 때문에 과연 미세하게 느린것일까? 라는 의문점 입니다.
저 문자열 비교하는 과정 자체가 사람이 느낄 수 있을정도로 많은 시간을 소모할 것이라고 생각되지 않습니다.
각 개별 페이지를 들어갈때 리소스 가져오는것들에 대해서 체크를 해보시는게 좋을 것 같습니다.
댓글을 작성하려면 로그인이 필요합니다.
</p>
<p>switch ($board[bo_table]) {</p>
<p>case "about_1": include_once(G5_PATH.'/mobile/sub/about_1.php'); break;</p>
<p>case "about_2": include_once(G5_PATH.'/mobile/sub/about_2.php'); break;</p>
<p>case "about_4": include_once(G5_PATH.'/mobile/sub/about_4.php'); break;</p>
<p>case "about_5": include_once(G5_PATH.'/mobile/sub/about_5.php'); break;</p>
<p>case "about_6": include_once(G5_PATH.'/mobile/sub/about_6.php'); break;</p>
<p>case "about_7": include_once(G5_PATH.'/mobile/sub/about_7.php'); break;</p>
<p>}</p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
</p>
<p><?php</p>
<p>if ($board[bo_table] == 'about_1' ) include_once(G5_PATH.'/mobile/sub/about_1.php');</p>
<p>else if ($board[bo_table] == 'about_2' ) include_once(G5_PATH.'/mobile/sub/about_2.php');</p>
<p>else if ($board[bo_table] == 'about_4' ) include_once(G5_PATH.'/mobile/sub/about_4.php');</p>
<p>else if ($board[bo_table] == 'about_5' ) include_once(G5_PATH.'/mobile/sub/about_5.php');</p>
<p>else if ($board[bo_table] == 'about_6' ) include_once(G5_PATH.'/mobile/sub/about_6.php');</p>
<p>else if ($board[bo_table] == 'about_7' ) include_once(G5_PATH.'/mobile/sub/about_7.php');</p>
<p>?></p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인