모바일로 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개
게시글 목록
| 번호 | 제목 |
|---|---|
| 23606 | |
| 23598 | |
| 23585 | |
| 23579 | |
| 23578 | |
| 23564 | |
| 23550 | |
| 23549 | |
| 23548 | |
| 23529 | |
| 23510 | |
| 23507 | |
| 23481 | |
| 23471 | |
| 23453 | |
| 23452 | |
| 23450 | |
| 23436 | |
| 23428 | |
| 23404 | |
| 23396 | |
| 23389 | |
| 23380 | |
| 23369 | |
| 23350 | |
| 23337 | |
| 23317 | |
| 23307 | |
| 23298 | |
| 23290 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기