PHP mobile browser detection?

后端 未结 10 1143
没有蜡笔的小新
没有蜡笔的小新 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条回答
  •  猫巷女王i
    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.

提交回复
热议问题