Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get_browser(); function is not working properly

Tags:

php

I am working on PHP 5.4.12 and I was trying to use get_browser(); function. But it is not working at all. I am getting the following error:

"Warning: get_browser(): browscap ini directive not set in C:\wamp\www\myfirstfile.php on line 4"

I first used browscap.ini present on my PC, then download one named php_browscap.ini, but both didn't work.

I am using wamp as my localhost. I set the location of browscap file in php.ini file:

[browscap]
; http://php.net/browscap
;browscap = "C:\wamp\bin\php\php5.4.12\php_browscap.ini"

Still it gives me that error I mentioned above.

My code:

<?php
$browser = get_browser(null,true);
print_r($browser);
?>
like image 375
mfs Avatar asked Feb 14 '26 15:02

mfs


1 Answers

You never enabled the option:

;browscap = "C:\wamp\bin\php\php5.4.12\php_browscap.ini"
^---- comment/disable

Remove the ;.

like image 83
Marc B Avatar answered Feb 16 '26 09:02

Marc B



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!