모바일로 pc 접속했을때만 모바일버전 버튼 보이는 소스입니다
[code]
<?php
if(G5_USE_MOBILE && !G5_IS_MOBILE) {
$seq = 0;
$p = parse_url(G5_URL);
$href = $p['scheme'].'://'.$p['host'].$_SERVER['PHP_SELF'];
if($_SERVER['QUERY_STRING']) {
$sep = '?';
foreach($_GET as $key=>$val) {
if($key == 'device')
continue;
$href .= $sep.$key.'='.strip_tags($val);
$sep = '&';
$seq++;
}
}
if($seq)
$href .= '&device=mobile';
else
$href .= '?device=mobile';
$mobile_agent = array("Iphone","Ipod","Android","Blackberry","SymbianOS|SCH-M\d+","Opera Mini", "Windows ce", "Nokia", "sony" );
$check_mobile = false;
for($i=0; $i<sizeof($mobile_agent); $i++){
if(stripos( $_SERVER['HTTP_USER_AGENT'], $mobile_agent[$i] )){
$check_mobile = true;
break;
}
}
if($check_mobile) { ?>
<a href="<?php echo $href; ?>" id="device_change" style="width:100%; padding:20px; height:50px;line-height:50px; font-size:50px;text-align:center">모바일 버전으로 보기</a>
<?
}
?>
[/code]
[code]
<?php
if(G5_USE_MOBILE && !G5_IS_MOBILE) {
$seq = 0;
$p = parse_url(G5_URL);
$href = $p['scheme'].'://'.$p['host'].$_SERVER['PHP_SELF'];
if($_SERVER['QUERY_STRING']) {
$sep = '?';
foreach($_GET as $key=>$val) {
if($key == 'device')
continue;
$href .= $sep.$key.'='.strip_tags($val);
$sep = '&';
$seq++;
}
}
if($seq)
$href .= '&device=mobile';
else
$href .= '?device=mobile';
$mobile_agent = array("Iphone","Ipod","Android","Blackberry","SymbianOS|SCH-M\d+","Opera Mini", "Windows ce", "Nokia", "sony" );
$check_mobile = false;
for($i=0; $i<sizeof($mobile_agent); $i++){
if(stripos( $_SERVER['HTTP_USER_AGENT'], $mobile_agent[$i] )){
$check_mobile = true;
break;
}
}
if($check_mobile) { ?>
<a href="<?php echo $href; ?>" id="device_change" style="width:100%; padding:20px; height:50px;line-height:50px; font-size:50px;text-align:center">모바일 버전으로 보기</a>
<?
}
?>
[/code]
댓글 6개
게시글 목록
| 번호 | 제목 |
|---|---|
| 23966 | |
| 23963 | |
| 23953 | |
| 23949 | |
| 23938 | |
| 23935 | |
| 23933 | |
| 23928 | |
| 23919 | |
| 23918 | |
| 23917 | |
| 23910 | |
| 23902 | |
| 23901 | |
| 23897 | |
| 23894 | |
| 23893 | |
| 23891 | |
| 23885 | |
| 23872 | |
| 23870 | |
| 23862 | |
| 23859 | |
| 23853 | |
| 23845 | |
| 23838 | |
| 23827 | |
| 23819 | |
| 23805 | |
| 23801 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기