PHP determines if a user is accessing a mobile phone

Source: Internet
Author: User

$agent=Check_wap ();if($agent ){    Header(' location:http://www.lewanau.com '); Exit;}//Check if WAPfunctionCheck_wap () {//first check whether it is a WAP proxy, high accuracy    if(Stristr($_server[' Http_via '], "WAP")){        return true; }    //Check if 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 determines if a user is accessing a mobile phone

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.