/", "", $msg); $value = preg_match("/.*$k">
当前位置:Gxlcms > PHP教程 > 站内搜索HTML版_PHP

站内搜索HTML版_PHP

时间:2021-07-01 10:21:17 帮助过:8人阅读

php
//require("config.inc.php");

function get_msg($path) {
global
$key, $i;
$handle = opendir($path);
while (
$filename = readdir($handle)) {
//echo $path."/".$filename."
";
$newpath = $path."/".$filename;
$check_type = preg_match("/\.html?$/", $filename);
if (
is_file($newpath) && $check_type) {
$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 "


".$newpath."


";
get_msg($path."/".$filename);
}
}
closedir($handle);
return
$i;
}

function
match_show($key, $msg, $newpath, $filename) {
global
$key, $i;
$key = chop($key);
if (
$key) {
$msg = preg_replace("/