php判断手机电脑并且进行跳转
发布网友
发布时间:2022-04-06 00:49
我来回答
共1个回答
热心网友
时间:2022-04-06 02:18
<?
$wap="手机地址";
$pc="pc地址";
ww($wap,$pc);
function ww($wap,$pc){
if(preg_match('/(blackberry|configuration\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $_SERVER['HTTP_USER_AGENT'])){header("Location: $wap");
exit;
}else{header("Location: $pc");
exit;}
}
?>追问
$wap="手机地址";
$pc="pc地址";
这个路径怎么填?我现在是本地测试的!