[php] 모바일 접속확인하기
페이지 정보
본문
<?php
function MobileCheck() {
global $HTTP_USER_AGENT;
$MobileArray = array("iphone","lgtelecom","skt","mobile","samsung","nokia","blackberry","android","android","sony","phone");
$checkCount = 0;
for($i=0; $i<sizeof($MobileArray); $i++){
if(preg_match("/$MobileArray[$i]/", strtolower($HTTP_USER_AGENT))){ $checkCount++; break; }
}
return ($checkCount >= 1) ? "Mobile" : "Computer";
}
?>
<?php
if(MobileCheck() == "Mobile") { ?>
<video src="<?php echo $view['wr_3']?>" controls style="width:640px; height:460px">이 브라우저는 재생할 수 없습니다.</video>
<?php } else { ?>
<?php if($view['wr_content']) { ?>
<iframe frameborder="0" width="640px" height="460px" src="<?php echo $view['wr_content']?>&iWidth=640&iHeight=460" allowfullscreen></iframe>
<?php } ?>
<?php } ?>
function MobileCheck() {
global $HTTP_USER_AGENT;
$MobileArray = array("iphone","lgtelecom","skt","mobile","samsung","nokia","blackberry","android","android","sony","phone");
$checkCount = 0;
for($i=0; $i<sizeof($MobileArray); $i++){
if(preg_match("/$MobileArray[$i]/", strtolower($HTTP_USER_AGENT))){ $checkCount++; break; }
}
return ($checkCount >= 1) ? "Mobile" : "Computer";
}
?>
<?php
if(MobileCheck() == "Mobile") { ?>
<video src="<?php echo $view['wr_3']?>" controls style="width:640px; height:460px">이 브라우저는 재생할 수 없습니다.</video>
<?php } else { ?>
<?php if($view['wr_content']) { ?>
<iframe frameborder="0" width="640px" height="460px" src="<?php echo $view['wr_content']?>&iWidth=640&iHeight=460" allowfullscreen></iframe>
<?php } ?>
<?php } ?>
추천0
댓글목록
등록된 댓글이 없습니다.