PHP to determine what channel to open the two-dimensional code

Source: Internet
Author: User
This time to everyone to bring PHP to judge from what channel open two-dimensional code, PHP judge from what channels to open the two-dimensional code of note what, the following is the actual case, together to see.

#问题

Problems encountered in the project if the user is using Access.

Then a friendly tip " how to open with a browser/tell users to open with a browser "

Scheme

UserAgent is a browser identifier with some customer information. such as browser kernel, operating system, etc.

Access to the Web page is also a browser, it also has UA. Then the UA will be able to tell if it's being accessed.

$ua = $_server[' http_user_agent '); Micromessenger is the Android/iphone version of the//windows Phone is the winphone version of the belt (this logo will hurt Winphone ordinary browser access) if (Strpos ($ua, ' Micromessenger ') = = False | | Strpos ($ua, ' Windows Phone ') = = False) {  echo "from normal browser access";} else{  echo "from browser access";}

Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!

Recommended reading:

How to operate phpstudy2018 Access directory service permissions

thinkphp Implementing Payment (JSAPI Payment) steps

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.