开发者

Check Browser PHP and put results in .txt [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How can I detect the browser with PHP or JavaScript?

I want to check what browser visitors to my site are using, and then save the results to a file named browser.txt on my server. Any i开发者_StackOverflowdeas? Thanks


Why not just install Google Analytics which does that (and an awful lot more) for you (albeit it doesn't store the data on your server)? Alternatively you could just check your server logs, the data should also be in there.


file_put_contents(
    __DIR__ . '/browser.txt',
    $_SERVER['HTTP_USER_AGENT'],
    FILE_APPEND
);


In php you can do this:

get_browser( $_SERVER['HTTP_USER_AGENT']);

it will return an object/array containing all the information you need. thake a look at PHP get_browser

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜