<?php function Mobile(){ if(isset($_SERVER['HTTP_USER_AGENT'])) { $client = array('mobile','android','iPhone','iPod','ios','wap'); if(preg_match("/(". implode('|',$client). ")/i",strtolower($_SERVER['HTTP_USER_AGENT']))){return true;} } return false; } if(Mobile()) { echo '手机端'; } else { echo '电脑端'; } ?>
本文结束