メモメモ <?php if (isset($_GET['viewmode'])) { $viewmode = $_GET['viewmode']; setcookie("viewmode", $viewmode, null, "/"); } else { $viewmode = $_COOKIE['viewmode']; } if ($viewmode != "pc") { $regex_ua_spn = "(iPhone|iPod|Android.*Mobile|BlackBerry)"; if (preg_match($regex_ua_spn, $_SERVER['HTTP_USER_AGENT']) != 0) { setcookie("viewmode", "sp", null, "/"); header("Location: /sp/"); } } ?> ルート直下に「lib」