In my PHP page I should display two different text contents according to whether the page run under mobile or desktop browser. Is there a way to perform this control in PHP?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Is there a way to play audio on a mobile browser w
There is a very nice PHP library for detecting mobile clients here: http://mobiledetect.net
Using that it's quite easy to only display content for a mobile:
I used Robert Lee`s answer and it works great! Just writing down the complete function i'm using:
There are many great open source projects that make detection a lot easier. To name two:
You can do it manually if you want.
Reference: http://php.net/manual/en/function.get-browser.php
You can even make it a script
Here is somewhat of a small list
Browsers
This script should work:
I came across it here: http://detectmobilebrowsers.com/ .