Home > Backend Development > PHP Tutorial > javascript - tp framework. Develop website. There are PC version and mobile version. How to automatically identify the visitor's device and then enter different versions.

javascript - tp framework. Develop website. There are PC version and mobile version. How to automatically identify the visitor's device and then enter different versions.

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-04 09:19:46
Original
1100 people have browsed it

TP framework develops websites with PC version and mobile version. How to automatically identify the visitor’s device and then enter different versions

There seems to be a very short Baidu code in my image that can achieve it, but now I can’t find it anymore. Please tell me the simplest method

Reply content:

TP framework develops websites with PC version and mobile version. How to automatically identify the visitor’s device and then enter different versions

There seems to be a very short Baidu code in my image that can achieve it, but now I can’t find it anymore. Please tell me the simplest method

<code>navigator.userAgent.match(/AppleWebKit.*Mobile.*/) </code>
Copy after login

<code>composer require mobiledetect/mobiledetectlib</code>
Copy after login

https://github.com/serbanghit...

Same answer useragent

mobile detect
is available on

github

You can also consider adaptive css framework like bootstrap

Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template