/**
* Tells what the user's browser is capable of
* @link https://php.net/manual/en/function.get-browser.php
* @param string $user_agent [optional] <p>
* The User Agent to be analyzed. By default, the value of HTTP
* User-Agent header is used; however, you can alter this (i.e., look up
* another browser's info) by passing this parameter.
* </p>
* <p>
* You can bypass this parameter with a &null; value.
* </p>
* @param bool $return_array [optional] <p>
* If set to true, this function will return an array
* instead of an object.
* </p>
* @return array|object|false Returns false if browscap.ini can't be loaded or the user agent can't be found, otherwise the information is returned in an object or an array which will contain
* various data elements representing, for instance, the browser's major and
* minor version numbers and ID string; true/false values for features
* such as frames, JavaScript, and cookies; and so forth.
* </p>
* <p>
* The cookies value simply means that the browser
* itself is capable of accepting cookies and does not mean the user has
* enabled the browser to accept cookies or not. The only way to test if
* cookies are accepted is to set one with setcookie,
* reload, and check for the value.
* @since 4.0
* @since 5.0
*/
function get_browser ($user_agent = null, $return_array = null) {}
PHP默认是没有browscap.ini这个配置文件的。需要自己下载安装:
下载地址:http://browscap.org/
这个配置项在php.ini中,查看PHP使用的ini文件位置:
php --ini
打开php.ini文件,找到这个地方
[browscap]
; http://php.net/browscap
;browscap = extra/browscap.ini
browscap = /usr/local/etc/php/7.1/php_browscap.ini
将下载的php_browscap.ini放到php目录下,或是其它地方也可以。将文件地址添加到php.ini中。注意:需要添加文件的绝对路径,否则可能不生效。。配置好后,重启php-fpm就可以了。