모바일로 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개
게시글 목록
| 번호 | 제목 |
|---|---|
| 24318 | |
| 24317 | |
| 24315 | |
| 24309 | |
| 24294 | |
| 24293 | |
| 24277 | |
| 24262 | |
| 24260 | |
| 24253 | |
| 24251 | |
| 24236 | |
| 24233 | |
| 24228 | |
| 24226 | |
| 24221 | |
| 24214 | |
| 24203 | |
| 24201 | |
| 24199 | |
| 24196 | |
| 24195 | |
| 24194 | |
| 24192 | |
| 24191 | |
| 24187 | |
| 24185 | |
| 24183 | |
| 24172 | |
| 24168 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기