以下代码检测到 PC 浏览器并进行重定向。这是一个工作。但是,我希望有人帮助改变它以显示一些东西。
<?
$webversion = "http://www.webversion.com";
$agent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match("/window/i", $agent)) {
header( "Location: $webversion" ) ;
}
if (preg_match("/mac/i", $agent)) {
header( "Location: $webversion" ) ;
}
if (preg_match("/microsoft/i", $agent)) {
header( "Location: $webversion" ) ;
}
if (preg_match("/linux/i", $agent)) {
header( "Location: $webversion" ) ;
}
?>
我想要它喜欢
if(usingPC)
echo 'something';
else
echo 'somethingelse'