PHP mobile browser detection?

后端 未结 10 858
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 06:03

I\'m in need of a way to detect mobile browsers server-side. I\'d like a way that requires me to do little to set up and little to maintain, yet still provide me with accura

相关标签:
10条回答
  • 2020-11-30 06:37

    A quick Google search picks up these:

    http://mobiforge.com/developing/story/lightweight-device-detection-php

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

    0 讨论(0)
  • 2020-11-30 06:39

    (edit: for now the Browser Capability Project is closed, i.e. atm this answer is not an option)

    All you need is get_browser() and a recent browscap.ini that maps the user-agent string to a browser/version and its capabilities.

    You can get a usually very up-to-date browscap.ini version from http://browsers.garykeith.com/downloads.asp

    0 讨论(0)
  • 2020-11-30 06:40

    Unfortunately WURFL is not free anymore for commercial projects.

    But there is OpenDDR with its experimental PHP implementation.

    0 讨论(0)
  • 2020-11-30 06:41

    I found this one to be very easy to use php-mobile-detect

    0 讨论(0)
  • 2020-11-30 06:42

    I once used to store temporarily visitors' ip-addresses and csrf-session values (meant to count current visitors).

    And I noticed that I had a side-gain of being able to see if the visitor used a mobile or a PC: The csrf of a mobile changes with every new page load, a PC doesn't; and the ip-addresses remain in both cases.

    Sure, you only detect a mobile if a visitor clicks twice and I have not checked how reliable this is (as I do not really need it), but it is php/server-side only.

    0 讨论(0)
  • 2020-11-30 06:45

    How about http://code.google.com/p/hdapi/ ? Server side mobile detection in PHP.

    0 讨论(0)
提交回复
热议问题