No nonsense on the code, the use of the method is
The code is as follows
Copy Code
if (IsMobile ()) {}if (!ismobile ()) {}?> function IsMobile () { $user _agent = $_server[' http_user_agent ']; $mobile _agents = Array ("2
Determine whether it is mobile phone or computer isMobile () or mobile phone ismobile
1. Write the method for judging the mobile phone in the PublicController.
2. inherit this method from the php controller IndexController. class. php:
3. Call and
Plan to use Nginx cache to mitigate back-end pressure. The website has two versions of mobile phone and desktop, currently using PHP for simple judgment, the code is as follows:
function isMobile(){ $ua = $_SERVER['HTTP_USER_AGENT']; $
Mobile_detect
is a lightweight, open source mobile device (mobile phone) detection PHP Class that uses strings in User-agent and combines HTTP headers to detect the mobile device environment. The most powerful thing about the PHP class library
To determine whether a website is accessed by a mobile user or a PC user, we only need to obtain the user's HTTP_USER_AGENT. I first introduced a general Mobile_Detect, the following two examples are self-written and hope to help you. php... to
Mobile_Detect is a lightweight, open-source mobile phone detection PHPClass. it uses strings in the User-Agent and uses HTTPHeader to detect the mobile device environment. The most powerful part of the PHP class library detected by this device is
Here we will introduce you to a mobile device check class, found from google mobile-detect class, this class can be ct judgment android, ios, Tablet, browser, perfect judgment, such as ipad, iPhone, and win8. Here we will introduce you to a mobile
Php user registration is often used to test the function instance summary, php user registration. Summary of common php user registration function examples. php user registration examples in this article summarize common php user registration
This article describes how to use PHP to detect mobiledetection for mobile devices. mobiledetection can detect the operating systems and browsers of most mobile phones and tablets. For more information, see the following, it is normal for a website
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.