| 目次 |
|---|
|
・リダイレクト ・サンプルコード ・サンプル |
(php部 : redirect.php )
<?php
// 閲覧しているブラウザ情報を取得する。
$http_user_agent = $_SERVER[HTTP_USER_AGENT];
// ブラウザの種類によってリダイレクト先を切り替える。
if( strlen( strpos($http_user_agent, "MSIE") ) > 0 ){
header("location: http://www.confrage.com/php/access/redirect/IE_sample.html");
}
else if( strlen( strpos($http_user_agent, "Mozilla") ) > 0 ){
header("location: http://www.confrage.com/php/access/redirect/NS_sample.html");
}
else{
header("location: http://www.confrage.com/php/access/redirect/OT_sample.html");
}
?>
(html部 : redirect.html ) <form method="post" action="redirect.php"> <input type="submit" value="リダイレクト"> </form>