PHPを使ってUAでiPhone判定

PHPを使ってUAでiPhone判定ができます。

<?php
$index_iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$is_iphone = false;
if ($index_iphone !== false){
  $is_iphone = true;
}
if($is_iphone == true){
  $css="./layout/iphone.css";
} else {
  $css="./layout/pc.css";
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo $css; ?>"/>

関連書籍:

同じタグの記事: iPhone
同じタグの記事: PHP
同じカテゴリの記事: General
同じカテゴリの記事: Linux
関連書籍: PHP