Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

it's not working.i mean i have many scripts to get ip and os but anyway get_browser is internal function and should work but its not.when i try to get a print_r on the function i get.

Array ( [browser_name_regex] => §^.*$§ [browser_name_pattern] => * [browser] => Default Browser [version] => 0 [majorver] => 0 [minorver] => 0 [platform] => unknown [alpha] => [beta] => [win16] => [win32] => [win64] => [frames] => 1 [iframes] => [tables] => 1 [cookies] => [backgroundsounds] => [cdf] => [vbscript] => [javaapplets] => [javascript] => [activexcontrols] => [isbanned] => [ismobiledevice] => [issyndicationreader] => [crawler] => [cssversion] => 0 [supportscss] => [aol] => [aolversion] => 0 ) 

I'm using win7 and firefox. And i have the latest browcap and set in php.ini.without that php returns error while idont get one.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
606 views
Welcome To Ask or Share your Answers For Others

1 Answer

I’ve heard many people complain about how the function just doesn’t work on their site. If you take a careful look at the manual, you’ll notice the following notice further down:

  1. The first thing you need to do is to check if your system has browscap.ini installed and if not, can you do so by yourself. invoke the phpinfo() function. This will help you gather some information about your system:

  2. If browscap is not installed, then look for Configuration File (php.ini) Path. This is where your PHP configuration file is located and enable browscap settings.After you’re done, it should look something like this:

    [browscap]

    browscap = "D:xamppphpextrasrowscap.ini"

  3. Restart your apache try the below code

    $browser = get_browser(null, true);

    print_r($browser);

  4. if still your get_browser() is not functioning proper there might be problem with your browscap.ini file. You can download the updated browscap.ini file from https://browsers.garykeith.com/downloads, and replace your browscap.ini will be located in /php/extras/browscap.ini

  5. Once you done, restart your apache again and execute the code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...