后端开发|php教程
关键词,搜索引擎
后端开发-php教程
中国源码库,vscode在哪更新,ubuntu 截屏,tomcat翻译,sqlite 怎么用,网页设计优缺点分析,discuz数据库详解,为什么叫云服务器,传奇3 插件代码,php 前端开发框架,网络爬虫英文,北京php,黄石seo,springboot打包前端,phpcms php标签,织梦企业门户网站,游戏网页设计代码是什么意思,个人网页模板 钢琴,dedecms后台菜单乱码,apache 某个页面301跳转,mfc学生管理系统rar,类似qq说说 程序源码lzw
datax源码,ubuntu怎么更改ip,爬虫登录违法么,在php中怎样能把商品加入到购物车,seo相关课题lzw
<?php
//获取关键词及所属来源搜索引擎名称
正版源码,ubuntu系统如何重置,草鞋爬虫子图片,php 匹配,聊城seo排行lzw
$search_url = isset($_GET[url])?$_GET[url]:\; //代表传入的地址
/*$search_url = urldecode($search_url);
print_r($search_url);
*/
$config = array(
"s1"=>array(
"domain" => "",
"kw" => "q",
"charset" => "utf-8"
),
"s3"=>array(
"domain" => "",
"kw" => "q",
"charset" => "utf-8"
),
"s4"=>array(
"domain" => "",
"kw" => "wd",
"charset" => "gbk"
),
"s5"=>array(
"domain" => "",
"kw" => "q",
"charset" => "utf-8"
),
"s6"=>array(
"domain" => "",
"kw" => "q",
"charset" => "utf-8"
),
"s7"=>array(
"domain" => "",
"kw" => "q",
"charset" => "utf-8"
),
"s8"=>array(
"domain" => "",
"kw" => "query",
"charset" => "gbk"
),
"s9"=>array(
"domain" => "",
"kw" => "q",
"charset" => "utf-8"
),
);
//函数作用:从url中提取关键词。参数说明:url及关键词前的字符。
function get_keyword($url,$kw_start)
{
$start = stripos($url,$kw_start);
$url = substr($url,$start+strlen($kw_start));
$start = stripos($url,&);
if ($start>0)
{
$start=stripos($url,&);
$s_s_keyword=substr($url,0,$start);
}
else
{
$s_s_keyword=substr($url,0);
}
return $s_s_keyword;
}
$arr_key = array();
foreach($config as $item){
$sh = preg_match("/\b{$item[domain]}\b/",$search_url);
if($sh){
$query = $item[kw]."=";
$s_s_keyword = get_keyword($search_url,$query);
$F_Skey=urldecode($s_s_keyword);
if($item[charset]=="utf-8"){
$F_Skey=iconv( "UTF-8","gb2312//IGNORE",$F_Skey); //最终提取的关键词
}
$keys = explode(" ",$F_Skey);
$arr_key[$item[domain]] = $keys;
}
}
echo "
";
print_r($arr_key);
?>