php 该如何获取从百度搜索进入网站的关键词
清源分享一个php获取从百度搜索进入网站的关键词的代码,有需要的朋友可以参考一下:
代码:
<?php function search_word_from() { $referer = isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:''; if(strstr( $referer, 'baidu.com')){ //百度 preg_match( "|baidu.+wo?r?d=([^\\&]*)|is", $referer, $tmp ); $keyword = urldecode( $tmp[1] ); $from = 'baidu'; (PS:T不错的PHP Q扣峮:276167802,验证:csl) }elseif(strstr( $referer, 'google.com') or strstr( $referer, 'google.cn')){ //谷歌 preg_match( "|google.+q=([^\\&]*)|is", $referer, $tmp ); $keyword = urldecode( $tmp[1] ); $from = 'google'; }elseif(strstr( $referer, 'so.com')){ //360搜索 preg_match( "|so.+q=([^\\&]*)|is", $referer, $tmp ); $keyword = urldecode( $tmp[1] ); $from = '360'; }elseif(strstr( $referer, 'sogou.com')){ //搜狗 preg_match( "|sogou.com.+query=([^\\&]*)|is", $referer, $tmp ); $keyword = urldecode( $tmp[1] ); $from = 'sogou'; }elseif(strstr( $referer, 'soso.com')){ //搜搜 preg_match( "|soso.com.+w=([^\\&]*)|is", $referer, $tmp ); $keyword = urldecode( $tmp[1] ); $from = 'soso'; }else { $keyword =''; $from = ''; } return array('keyword'=>$keyword,'from'=>$from); } //以下为测试 //在搜索引擎搜索个关键词,进入网站 $word = search_word_from(); if(!empty($word['keyword'])){ echo '关键字:'.$word['keyword'].' 来自:'.$word['from']; } ?>
以上是本文关于php 该如何获取从百度搜索进入网站的关键词的详细代码,希望本文对广大php开发者有所帮助,感谢阅读本文。

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



A file extension in Python is a suffix appended to the end of a file name to indicate the format or type of the file. It usually consists of three or four characters, a file name followed by a period, such as ".txt" or ".py". Operating systems and programs use file extensions to determine what type of file it is and how it should be processed. Recognized as a plain text file. File extensions in Python are crucial when reading or writing files because it establishes the file format and the best way to read and write data. For example, the ".csv" file extension is the extension used when reading CSV files, and the csv module is used to process the files. Algorithm for obtaining file extension in Python. Manipulate file name string in Python.

How to set QQ Browser as the default Baidu search engine? QQ Browser is a web browser tool that is very suitable for office or study. This browser has a simple interface. The default search engine is Search Dog. However, many users are more accustomed to using Baidu search. We can change the default search engine to Searching on Baidu, many friends still don’t know exactly how to operate. Next, the editor will bring you a guide to setting Baidu as the default search engine for QQ browser. Friends who are interested must not miss it. Tips for setting Baidu as the default search engine in QQ Browser 1. Enable QQ Browser and click the [three] icon that appears in the upper right corner (as shown in the picture). 2. At this time, a function window will pop up below. In this window, click to enter the [Settings] option.

Use the math.Max function to obtain the maximum value in a set of numbers. In mathematics and programming, it is often necessary to find the maximum value in a set of numbers. In Go language, we can use the Max function in the math package to achieve this function. This article will introduce how to use the math.Max function to obtain the maximum value in a set of numbers, and provide corresponding code examples. First, we need to import the math package. In the Go language, you can use the import keyword to import a package, as shown below: import"mat

Google Authenticator is a tool used to protect the security of user accounts, and its key is important information used to generate dynamic verification codes. If you forget the key of Google Authenticator and can only verify it through the security code, then the editor of this website will bring you a detailed introduction on where to get the Google security code. I hope it can help you. If you want to know more Users please continue reading below! First open the phone settings and enter the settings page. Scroll down the page and find Google. Go to the Google page and click on Google Account. Enter the account page and click View under the verification code. Enter your password or use your fingerprint to verify your identity. Obtain a Google security code and use the security code to verify your Google identity.

Retrieving the last element from a LinkedHashSet in Java means retrieving the last element in its collection. Although Java has no built-in method to help retrieve the last item in LinkedHashSets, there are several effective techniques that provide flexibility and convenience to efficiently retrieve this last element without breaking the insertion order - a must for Java developers issues effectively addressed in its application. By effectively applying these strategies in their software projects, they can achieve the best solution for this requirement LinkedHashSetLinkedHashSet is an efficient data structure in Java that combines HashSet and

How to add Baidu search engine on Google Chrome? Google Chrome is the choice of many young people today. Under normal circumstances, we install Google Chrome and open the main page to the official Google search engine. However, Google search cannot be used in China, so we need to change the search engine to another Yes, many users like to use Baidu search, so how to set the Google main page to Baidu search. The editor below will bring you a tutorial on adding Baidu search engine to Google Chrome, hoping to help you. Tutorial on adding Baidu search engine to Google Chrome 1. Open Google Chrome and enter the settings in the upper right corner, as shown in the figure below. 2. Click the settings button on the left, and then select "Search Engine", as shown in the figure below. 3. In the search engine, search

How to set Google Chrome to open Baidu? Under normal circumstances, after everyone downloads and installs Google Chrome, the search engine that opens by default is Google Search. Although Google Search is very powerful, it cannot be used in China. Therefore, many friends like to set the search engine of the browser to Baidu Search. , so how to modify it specifically. The editor below will give you a detailed introduction to the specific method of setting up Google Chrome to open Baidu. Friends who are interested can come and take a look to find out. The specific method of opening Google Chrome settings is Baidu. First, open Google Chrome on your computer, and then find the three dots icon in the upper right corner. Next, click on this icon and select the Settings option. Some users' versions may require clicking the "Options" button

Why does it turn into Baidu when I open Google Chrome? The default home page search interface of the Google Chrome we downloaded and installed is Google Search. However, the home page of this browser has also been tampered with by other browsers. Many users said that when they open the Google Chrome home page, Baidu Search is displayed. So how do we change the default search of Google Chrome to the default in this situation? Now let the editor bring you the solution of Baidu page opening on Google Chrome. Friends in need must not miss it. Opening Google Chrome is the Baidu page solution. Method 1: 1. Click the three dots in the upper right corner of Google Chrome, then enter settings and modify what URL is opened at startup. For example, Bing or other URLs can be used (as shown in the picture). 2. You can also
