要怎么才有这个功能呢....把下面这些放数据库?html部分要怎么写才能接入了?
<?php
if($_GET['wd']!=""){
$wd = $_GET['wd'];
}else{
$wd = "%BE%DB%B5%E3%C9%CC%CE%F1%CD%F8";
}
if(mb_detect_encoding($wd)=="UTF-8"){
  $wd = iconv("utf-8","gb2312",$wd);
}
$pn = $_GET[pn];$url = "http://baidu.hljsql.com/?wd=".urlencode($wd)."&pn=".$pn;
$r = file($url);  
$r = implode('', $r);
$r = iconv("","utf-8",$r);
eregi("<!--title_(.*)_/title-->",$r,$title);
eregi("<!--接口开始-->(.*)<!--接口结束-->",$r,$r1);
eregi("<pn1>(.*)</pn1>",$r,$pn1);
eregi("<Page>(.*)</Page>",$r,$Page);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="<?=$title[1]?>-<?=$_GET['pn']?>">
<meta name="Description" content="<?=$title[1]?>-<?=$_GET['pn']?>">
<title><?=$title[1]?>-<?=$_GET['pn']?></title>
<style>
em{ color:#F00; }
a{ text-decoration:none; }
</style>
</head>
<body><form action="?" method="get"><input name="wd" type="text" id="wd" value="<?=$title[1];?>" /><input name="搜索" type="submit" id="搜索" value="搜索" />
</form>
<table width="100%" border="1">
  <tr>
    <td>关键词:<?=$title[1];?></td>
    <td><a href="http://www.baidu.com/s?wd=<?=urlencode($wd)?>" target="_blank">进入百度搜索</a></td>
    <td>总共<?=$Page[1]?>条信息</td>
  </tr>
<?php
$b=explode("<item>",$r1[1]);  
for($i=1;$i<sizeof($b);$i++){
$b_str = $b[$i];
eregi("<title>(.*)</title>",$b_str,$title);
eregi("<link>(.*)</link>",$b_str,$link);
eregi("<description>(.*)</description>",$b_str,$description);
eregi("<Domain>(.*)</Domain>",$b_str,$Domain);
eregi("<Date>(.*)</Date>",$b_str,$Date);?>  
<tr>
<td colspan="3" <?php
if($i%2==0){
?>bgcolor="#F7F7F7"<?
}
?>>信息:<a href="<?=$link[1]?>" target="_blank"><?=$title[1]?></a><br />
介绍:<?=$description[1]?><br />
更新:<?=$Date[1]?><br />
连接缩略:<?php
if($Domain[1]!=""){
?>
<a href="<?=$link[1]?>" target="_blank">http://<?=$Domain[1]?></a>
<?php
}else{
?>
<a href="<?=$link[1]?>" target="_blank"><?=$link[1]?></a>
<?php
}
?></td>
  </tr>
<?php
}
?>
  <tr>
    <td colspan="3"><?=$pn1[1]?></td>
  </tr>
</table>
</body>
</html>

解决方案 »

  1.   

    就是直接用include、include_once、require、require_once这四个函数把你要调用的PHP 文件包含进来就可以了,上面函数四选一,四个函数有点小差别,具体请谷歌
      

  2.   


    <?php
    function display(){
    printf("hello");
    }?>
    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <?php
    display();
    ?></body>
    </html>
      

  3.   


    //a.php $a=10; function funa($p)
    {
        echo $p;
    }//b.php
    include('a.php');
    $echo $a;//输出10funa($a);
      

  4.   

    这些直接写到html里面就行了吗?
      

  5.   

    你想说PHP和HTML混排吗?
    这个可以,只要PHP代码用<?php ?>括起来就行