php文本站内全文检索

王朝php·作者佚名  2008-05-21
窄屏简体版  字體: |||超大  

<?php/****************************************************原作者: uchinaboy

修改:lingshidao特点:无需mysql支持;速度快;无需设置路径,放在哪级目录下,就搜索该目录和子目录;可以搜索一切文本类型的文件;显示文件相关内容;关键词自动高亮显示。修改内容:增加了自动分页和风格设置文件。搜索框代码(如果放在search.php相同目录下,无需修改):<form method="post" action="search.php"><input type="text" name="key" size=40 value="">

<input type="submit" value="检索"></form>****************************************************/require ("template.php");echo "<p align="center">";echo "检索结果";echo "</p><hr>";if (function_exists("set_time_limit") && !get_cfg_var('safe_mode')){set_time_limit(600);}function get_msg($path) {global $key, $i;$handle = opendir($path);while ($filename = readdir($handle)) {//echo $path."/".$filename."<br>";$newpath = $path."/".$filename;if (is_file($newpath)) {$fp = fopen($newpath, "r");$msg = fread($fp, filesize($newpath));fclose($fp);match_show($key, $msg, $newpath, $filename);}if (is_dir($path."/".$filename) && ($filename != ".") &&

($filename != "..")) {//echo "<BR><BR><BR>".$newpath."<BR><BR><BR>";get_msg($path."/".$filename);}}closedir($handle);return $i;}

function match_show($key, $msg, $newpath, $filename) {

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航