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

html 게시판 로딩 속도 채택완료

잠다 6년 전 조회 2,029

</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개

채택된 답변
+20 포인트

bo_table과 파일명이 같다면 차라리 그냥 쓰시는 게 낫지 않나 싶네요.

include_once(G5_PATH."/mobile/sub/".$board['bo_table'].".php";

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

답변에 대한 댓글 3개

s
sinbi
6년 전
역시 보통 계란이 아니셨엉...ㅎ
잠다
6년 전
앞뒤로 조건문도 넣으면 무용지물 아닌가요?...
왕계란
6년 전
조건문 대신에 넣으셔야 합니다.
제가 그 말은 안 썼네요.
위에 올리신 조건문 모두 제거하시고 저 한 줄 넣으시면 돼요.

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

6년 전

위 if 문은 속도저하하고는 관련이 없습니다. if 문 처리에 들어가는 시간은 0.0001 초 미만일 거에요.~

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

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

이 화면은 왕계란님 말씀처럼 처리하시면 될거 같습니다.

 

그런데 가장 크게 마음에 걸리는거는 저 if문 때문에 과연 미세하게 느린것일까? 라는 의문점 입니다.

 

저 문자열 비교하는 과정 자체가 사람이 느낄 수 있을정도로 많은 시간을 소모할 것이라고 생각되지 않습니다.

 

각 개별 페이지를 들어갈때 리소스 가져오는것들에 대해서 체크를 해보시는게 좋을 것 같습니다.

 

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

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

e
6년 전

</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>

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

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

e
6년 전

</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>

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

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

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

로그인