Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use get_browser in php

Shulou Source: shulou.com Published: 2022-06-03 13:18:11 09月25日 Update

This article mainly introduces how to use get_browser in php, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

The php get_browser function can measure the performance of the user's browser by consulting the user's browscap.ini file, and its syntax is "get_browser (user_agent,return_array)".

This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer

Php get_browser usage

The get_browser () function returns the performance of the user's browser.

This function measures the performance of the user's browser by consulting the user's browscap.ini file.

If successful, the function returns an object or an array containing the user's browser information, or false if it fails.

Grammar

Get_browser (user_agent,return_array)

Parameters.

User_agent

Optional. Specifies the name of the HTTP user agent. The default is the value of $HTTP_USER_AGENT.

You can bypass this parameter by setting NULL.

Return_array is optional. If this parameter is set to true, this function returns an array instead of an object.

Tips and comments

Note: the return statement immediately terminates the evaluation of the string.

Note: this function is useful for code storage in the database text field for later calculation.

Examples

Output:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Array ([browser_name_regex] = > ^ mozilla/.\ .0. *;. * windows nt 5\ .1. *\ .net clr.*). * $[browser_name_pattern] = > Mozilla/?.0 (compatible; MSIE 6.0 *) * Windows NT 5.1*.NET CLR*) * [parent] = > IE 6.0 [platform] = > WinXP [netclr] = > 1 [browser] = > IE [version] = > 6.0 [majorver] = > 6 [minorver] = > 0 [css] = > 2 [frames] = > 1 [iframes] = > 1 [tables] = > 1 [cookies] = > 1 [backgroundsounds] = > 1 [vbscript] = > 1 [javascript] = > 1 [javaapplets] = > 1 [activexcontrols] = > 1 [cdf] = > 1 [aol] = > [beta] = > [win16] = > [crawler] = > [stripper] = > [wap] = > [ak] = > [sk] = >) Thank you for reading this article carefully I hope the article "how to use get_browser in php" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Users functions browsers articles browsing parameters performance comments objects arrays files syntax measurement success code value examples information interests can be accessed through the Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple macOS Microsoft Xiaomi OPPO Reno