Copy CodeThe code is as follows:
$key = $_get[' key ']; Get keywords
$select = $_get[' select ']; Get the Search engine choice
Switch ($select)//jump to a different page depending on the search engine
{
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"://Baidu
$url = "http://www.baidu.com/s?wd=". $key;
Header ("Location: $url");
Break
Default://If the search engine does not exist, end the program
Break
}
?>
Run result 36-4 as shown.
Figure 36-4 PHP Comprehensive search engine
After clicking the "Submit" button, you can see that the Yahoo website has been opened and found the relevant search results, as shown in 36-5.
Figure 36-5 Yahoo's search results
http://www.bkjia.com/PHPjc/327855.html www.bkjia.com true http://www.bkjia.com/PHPjc/327855.html techarticle Copy the code as follows: PHP $key = $_get[' key ');//get keyword $select = $_get[' select ');//Get Search engine selection switch ($select)//jump to ... according to different search engines /c5>