With the popularity of mobile devices, the site will also usher in more and more mobile device access. Adapt to the PC's page, many times the user is not friendly to the phone, then sometimes we need to determine whether users use mobile phone access, if it is mobile phone, jump to the designated mobile phone-friendly page. Here's how to tell if a user is using a mobile phone to access it. Royal Casino
The custom functions are as follows:
$agent = Check_wap (), if ($agent) {header (' location:http://www.nowamagic.net '); exit;} Check if WAP function Check_wap () {//checks whether it is a WAP proxy, high accuracy if (stristr ($_server[' Http_via ', "WAP")) {return true;} Check whether the browser accepts Wml.elseif (Strpos (Strtoupper ($_server[' http_accept ')), "VND. Wap. WML ") > 0) {return true; } Check user_agent elseif (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 ']) {return true;} Else{return false; }}
PHP CodeBase: Determine if a user is accessing a mobile phone