Home > Backend Development > PHP Tutorial > 基于文本的搜索_PHP

基于文本的搜索_PHP

WBOY
Release: 2016-06-01 12:42:32
Original
1030 people have browsed it

为了增强我的网站上的功能,本人根据本人的网站的实际,开发了一个基于文本的搜索,现在使用在本人的网站上。为了
和广大网友相互学习交流,本人现在其源码公布,其源码如下:
            $dispstr=array();
            $dispstr[1]="disp_os.php?article_id=";
            $dispstr[2]="disp_webma.php?article_id=";
            $dispstr[3]="disp_webcrea.php?article_id=";
            $dispstr[4]="disp_program.php?article_id=";
            $dispstr[5]="disp_create.php?article_id=";
    $file=file("news.txt");
    $file1=file("part.txt");
    $file2=file("number.txt");
    if(!isset($pagenum)){
      $pagenum=1;
    }
    $lesssign=0;
    $num=count($file);
    $dispnumbeg=6*($pagenum-1);;
    $artnumeof=6*$pagenum;
    $isdispnum=$num-$artnumeof;
    if($isdispnum       $dispnumeof=$num;
      $lesssign=1;
    }
    else{
      $dispnumeof=$artnumeof;
    }
    $sign=0;
    $pagec=0;
     for($icount=0;($icount       for($i=0;$i        if(($icount*6+$i)==$num){
           $sign=1;
         }
       }
       $pagec++;
     }
    $pagecount=$pagec;

    $fuhao="◇  ";
    $color=e9eae9;
    $iscolor=0;
    //$linkstr="disp_os.php?article_id=";
    $lessnum=0;
    for($i=$dispnumbeg;$i        $partnum=intval($file1[$i]);
       if($partnum==0){
         $dispvar=$fuhao.$file[$i];
         echo"

";
         echo $dispvar;
         echo"";
         $lessnum++;
         }
       else{

           $linkstr=$dispstr[$partnum];
           $linknum=$file2[$i];
           $lessnum++;
           $link=$linkstr.$linknum;
           $dispvar=$fuhao.$file[$i];
           echo"";
           echo"$dispvar";
           echo"";
        }
       if($iscolor==0){
         $color=ffffff;
         $iscolor=1;
       }
       else{
         $color=e9eae9;
         $iscolor=0;
       }
    }
    if($lesssign==1){
      for($iless=$lessnum;$iless        echo"";
       echo $fuhao."
n";
       echo"";
          if($iscolor==0){
         $color=ffffff;
         $iscolor=1;
       }
       else{
         $color=e9eae9;
         $iscolor=0;
       }
       }
    }
    echo"";
   ?>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template