Home>Article>Backend Development> How to modify user agent in php
How to modify user agent in php: 1. Enter "about:config" in the Firefox address bar; 2. Create a new String key value; 3. Assign this key value to the UA you want to modify. .
The operating environment of this article: windows7 system, firefox88.0&&PHP7.1 version, DELL G3 computer
How to modify user agent in php?
In some cases, we need to modify the ua information of firefox to trick the program into telling it that we are a certain browser. For example, when the author was developing wap two days ago, because I was using xhtml, There is no need to use a mobile phone simulator, just use this trick to debug with firefox. This requires us to know how to modify the user agent information
Other browsers do not know, the following is the user agent modification method of friefox.
1. Enter about:config in the Firefox address bar.
2, right-click to create a String key value named general.useragent.override. (If the key value already exists, there is no need to create a new one.)
3. Assign this key value to the UA you want to modify.
Common UA:
"Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.6) Gecko/20070914 Firefox/2.0.0.7" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.15.5 (KHTML, like Gecko) Version/3.0.3 Safari/522.15.5" "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/103u (KHTML, like Gecko) safari/100" "Opera/9.23 (X11; Linux x86_64; U; en)"
Note: There will be more and more smart phones in the future, and more and more mobile wap sites will use html/xhtml, so you know how to change ua to use pc browser There is nothing that every PHPer must know when browsing a WAP site. Here, the author has collected this article for you to prepare for emergencies.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to modify user agent in php. For more information, please follow other related articles on the PHP Chinese website!