Get the user's browser and version information
<span>function </span><span>determinebrowser () { </span><span>$agent </span><span>= </span><span>isset</span><span>(</span><span>$_SERVER</span><span>[</span><span>'HTTP_USER_AGENT'</span><span>]) ? </span><span>$_SERVER</span><span>[</span><span>'HTTP_USER_AGENT'</span><span>] : </span><span>'' </span><span>; </span><span>$browseragent </span><span>= </span><span>""</span><span>; </span><span><em>//</em></span><span><em>浏览器 </em></span><span><em></em></span><span>$browserversion </span><span>= </span><span>""</span><span>; </span><span><em>//</em></span><span><em>浏览器的版本 </em></span><span><em></em></span><span>if </span><span>(</span><span><em>preg_match</em></span><span>(</span><span>'/360SE/i'</span><span>,</span><span>$agent</span><span>)) { </span><span>$browserversion </span><span>= </span><span>''</span><span>; </span><span>$browseragent </span><span>= </span><span>"360</span><span>浏览器</span><span>"</span><span>; </span><span> } </span><span>else if</span><span>(</span><span><em>preg_match</em></span><span>(</span><span>'/Maxthon (([0-9_.]{1,2}+))/i'</span><span>,</span><span>$agent</span><span>,</span><span>$version</span><span>)){ </span><span>$browserversion </span><span>= </span><span>$version</span><span>[</span><span>1</span><span>]; </span><span>$browseragent </span><span>= </span><span>"Maxthon"</span><span>; </span><span> }</span><span>else if </span><span>(</span><span><em>preg_match</em></span><span>(</span><span>'/MSIE (([0-9_.]{1,2})+)/i'</span><span>,</span><span>$agent</span><span>,</span><span>$version</span><span>)) { </span><span>$browserversion </span><span>= </span><span>$version</span><span>[</span><span>1</span><span>]; </span><span>$browseragent </span><span>= </span><span>"Internet Explorer"</span><span>; </span><span> } </span><span>else if </span><span>(</span><span><em>preg_match</em></span><span>( </span><span>'/iOpera\/(([0-9_.]{1,2})+)/i'</span><span>,</span><span>$agent</span><span>,</span><span>$version</span><span>)) { </span><span>$browserversion </span><span>= </span><span>$version</span><span>[</span><span>1</span><span>]; </span><span>$browseragent </span><span>= </span><span>"Opera"</span><span>; </span><span> } </span><span>else if </span><span>(</span><span><em>preg_match</em></span><span>( </span><span>'/Firefox\/(([0-9_.]{1,3})+)/i'</span><span>,</span><span>$agent</span><span>,</span><span>$version</span><span>)) { </span><span>$browserversion</span><span>=</span><span>$version</span><span>[</span><span>1</span><span>]; </span><span>$browseragent </span><span>= </span><span>"Firefox"</span><span>; </span><span> } </span><span>else if </span><span>(</span><span><em>preg_match</em></span><span>( </span><span>'/Chrome\/(([0-9_.]{1,5})+)/i'</span><span>,</span><span>$agent</span><span>,</span><span>$version</span><span>)) { </span><span>$browserversion </span><span>= </span><span>$version</span><span>[</span><span>1</span><span>]; </span><span>$browseragent </span><span>= </span><span>"Chrome"</span><span>; </span><span> } </span><span>else if </span><span>(</span><span><em>preg_match</em></span><span>( </span><span>'/Safari\/(([0-9_.]{1,5})+)/'</span><span>,</span><span>$agent</span><span>,</span><span>$version</span><span>)) { </span><span>$browserversion </span><span>= </span><span>$version</span><span>[</span><span>1</span><span>]; </span><span>$browseragent </span><span>= </span><span>"Safari"</span><span>; </span><span> } </span><span>else </span><span>{ </span><span>$browserversion </span><span>= </span><span>""</span><span>; </span><span>$browseragent </span><span>= </span><span>"Unknown"</span><span>; </span><span> } </span><span>return </span><span>$browseragent</span><span>.</span><span>" "</span><span>.</span><span>$browserversion</span><span>; </span><span>}</span>
The above introduces how to obtain the user's browser and version information, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Recently, the Fudan University Natural Language Processing Team (FudanNLP) launched a review paper on LLM-basedAgents. The full text is 86 pages long and has more than 600 references! Starting from the history of AIAgent, the authors comprehensively sort out the current status of intelligent agents based on large-scale language models, including: the background, composition, application scenarios of LLM-basedAgent, and the agent society that has attracted much attention. At the same time, the authors discussed forward-looking and open issues related to Agent, which are of great value to the future development trends of related fields. Paper link: https://arxiv.org/pdf/2309.07864.pdfLLM-basedAgent paper list:

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Introduction to JavaAgent technology JavaAgent is literally translated as Java agent, and is often called Java probe technology. JavaAgent was introduced in JDK1.5 and is a technology that can dynamically modify Java bytecode. Classes in Java are compiled to form bytecodes that are executed by the JVM. The JVM obtains the information of these bytecodes before executing these bytecodes, and modifies these bytecodes through a bytecode converter to complete the process. Some extra features. JavaAgent is a jar package that cannot run independently. It works through the JVM process attached to the target program. When starting, you only need to add the -javaagent parameter to the startup parameters of the target program to add Cla

Hello everyone, I am Lao Du. Yesterday, I listened to the AI hospital town shared by Tsinghua University Intelligent Industry Research Institute at the company. Picture: This is a virtual world. All doctors, nurses, and patients are Agents driven by LLM and can interact independently. They simulated the entire process of diagnosis and treatment, and achieved a state-of-the-art accuracy of 93.06% on a subset of the MedQA data set covering major respiratory diseases. An excellent intelligent agent is inseparable from excellent design patterns. After reading this case, I quickly read the four main Agent design patterns recently published by Mr. Andrew Ng. Andrew Ng is one of the most authoritative scholars in the world in the field of artificial intelligence and machine learning. Then, I quickly compiled it and shared it with everyone. Mode 1. Reflection

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。

图片消失如何解决先是图片文件上传$file=$_FILES['userfile']; if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'

图片消失如何解决先是图片文件上传$file=$_FILES['userfile']; if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'
