Share a PHP class that detects whether a user accesses a website using a mobile phone_PHP Tutorial

WBOY
Release: 2016-07-20 11:15:21
Original
696 people have browsed it

There is an open source PHP program based on the MIT License

http://code.google.com/p/php-mobile-detect/

The program is just a file, you can just quote it directly after downloading.

How to use:

<span><?php</span>
<span>include</span><span>(</span><span>"Mobile_Detect.php"</span><span>)</span><span>;</span>
<span>$detect</span> <span>=</span> <span>new</span> Mobile_Detect<span>(</span><span>)</span><span>;</span>
 
<span>if</span> <span>(</span><span>$detect</span><span>-></span><span>isMobile</span><span>(</span><span>)</span><span>)</span> <span>{</span>
    <span>// any mobile platform</span>
    <span>echo</span> <span>'isMobile'</span><span>;</span>
<span>}</span>
<span>else</span><span>{</span>
    <span>echo</span> <span>'isPC'</span><span>;</span>
<span>}</span>
<span>?></span>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440205.htmlTechArticleThere is an open source PHP program based on the MIT License http://code.google.com/p/php- The mobile-detect/ program is just a file, you can just reference it directly after downloading it. How to use: ?php...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!