사용자가 내 index.php 페이지 맨 위에이 스크립트로 어떤 플랫폼을 사용하고 있는지 감지하려고하지만 내 컴퓨터 브라우저에서 페이지를 방문 할 때 리디렉션되지 않습니다 (google.com으로 리디렉션되어야 함)왜이 간단한 리디렉션 스크립트가 작동하지 않습니까?
<?php
//Detect special conditions devices
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
//do something with this information
if($iPod || $iPhone){
header("Location: http://example.com/myOtherPage.php");
}else if($iPad){
//browser reported as an iPad -- do something here
}else if($Android){
header("Location: http://example.com/myOtherPage.php");
}else if($webOS){
header("Location: http://google.com");
}
?>
감사
'위해서 var_dump를 리디렉션 아니에요 ($ _ SERVER [ 'HTTP_USER_AGENT']);'- 당신은 무엇을 어떻게해야합니까? –