Pergunta

I have just tried enabling php_browscap.ini so that I can use the get_browser function.

However, it seems to display an empty array?

$user_agent = get_browser(null, true);

print_r($user_agent);

In my php.ini file, I have the following:

[browscap]
; http://php.net/browscap
browscap = C:/wamp/bin/php/php5.3.0/extra/php_browscap.ini

I am probably missing something simple?

Update

Output 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 ) 
Foi útil?

Solução

You could find if there's something else failing using tools like ProcMon. This tool will tell you which files had been accessed, and what was the result. So, you have to open it, highlight the browsercap ini's path, restart the webserver and see if any of this scenarios fits:

  • File doesn't exist
  • Permission denied
  • Finding wrong path
  • Doesn't appear at all

ProcMon is a Wonderful tool if you're in Windows.

If you find any of those scenarios, and don't know what to do, just edit your question :-)

Good luck!

Outras dicas

There are several php.ini files for WAMP. To get to the right one, access it using the WAMP tray icon. That's how I got it to work. As it turns out, in my case it used the one in C:\Apps\wamp\bin\apache\apache2.2.22\bin.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top