랜덤으로 php 인클루드 시키는법 알려주세요
include_once("$g4[path]/main/news/auto_tap2.php");
include_once("$g4[path]/main/news/auto_tap1.php");
include_once("$g4[path]/main/news/auto_tap3.php");
3가지 랜덤으로 불러오고싶습니다 코드좀알려주세요
include_once("$g4[path]/main/news/auto_tap1.php");
include_once("$g4[path]/main/news/auto_tap3.php");
3가지 랜덤으로 불러오고싶습니다 코드좀알려주세요
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 4개
$RandCode = rand(1, 3);
include_once("$g4[path]/main/news/auto_tap{$RandCode}.php");
[/code]
숫자라면 이렇게 가능합니다.
$IncludeList= array(
"$g4[path]/main/news/auto_tap2.php",
"$g4[path]/main/news/auto_tap1.php",
"$g4[path]/main/news/auto_tap3.php"
);
$RandCode = array_rand($IncludeList, 1);
include_once($IncludeList[$RandCode]);
[/code]
이렇게도 가능할걸요?