'; $end = ''; $fd = fopen ($filename, "r"); $tpbuffer=""; $i = 0; while (!feof ($fd) && $i++ <= 3000) { $tpbuffer .= fgets($fd, 8192); } fclose ($fd); $tpbuffer = strstr($tpbuffer,$begin); $tpstart = strlen($begin ); $tppos = strpos($tpbuffer, $end); $tpbuffer = substr($tpbuffer,$tpstart,($tppos -$tpstart) ); $patterns= array ( "/\.asp/" ,"/vs_(.+)\.htm/" ,"/\.\.\/image\//" ); $replacements= array (".php" ,"sclass_vs.php?\\1" ,"http://image.sportscn.com/2009/tennis/" ); if ($tpbuffer == "") { echo "无相关记录"; } print preg_replace($patterns, $replacements, $tpbuffer); ?>