源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

解析PHP对现有搜索引擎的调用

  • 时间:2020-09-18 13:14 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:解析PHP对现有搜索引擎的调用
[u]复制代码[/u] 代码如下:
<?php     $key = $_GET['key'];                        //获得关键字     $select = $_GET['select'];                  //获得搜索引擎的选择     switch($select)                             //根据搜索引擎的不同跳转到不同的页面     {         case "google":                          //GOOGLE             $url = "http://www.google.com/search?q=".$key;             header("Location: $url");             break;         case "yahoo":                           //YAHOO             $url = "http://search.yahoo.com/search?p=".$key;             header("Location: $url");             break;         case "baidu":                           //百度             $url = "http://www.baidu.com/s?wd=".$key;             header("Location: $url");             break;         default:                                //如果搜索引擎不存在,结束程序             break;     } ?>
运行结果如图36-4所示。 [img]http://files.jb51.net/file_images/article/201306/201306251134543.jpg[/img] 图36-4  PHP综合搜索引擎 单击【Submit】按钮后,可以看到Yahoo网站被打开了,并搜索到了相关的搜索结果,如图36-5所示。 [img]http://files.jb51.net/file_images/article/201306/201306251134544.jpg[/img] 图36-5  Yahoo的搜索结果
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部