<div class="codetitle"><a style="CURSOR: pointer" data="60012" class="copybut" id="copybut60012" onclick="doCopy('code60012')"> 代码如下:<div class="codebody" id="code60012"> <?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所示。
 图36-4PHP综合搜索引擎
单击【Submit】按钮后,可以看到Yahoo网站被打开了,并搜索到了相关的搜索结果,如图36-5所示。
 图36-5 Yahoo的搜索结果 (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|