以下是源码,供大家参考:
//php 多层文件自动文件转换系统。
//适用于连续文件。
//参数说明
//$site 需要处理的目录
$site=d:/update;
insert($site);
function cchange($path1,$path2){
$lastchar=;
$temp=file($path1);
for ($i=0;$i$temp[$i]=str_replace(
,#br#,$temp[$i]);
$temp[$i]=str_replace(
,#br#,$temp[$i]);
$lastchar.=$temp[$i];
}
$lastchar=strip_tags($lastchar);
$handle=fopen($path2,w);
fwrite($handle,$lastchar);
fclose($handle);
$ctemp=file($path2);
$max=0;
$pos=0;
$end=;
for ($i=0;$i//文章抓取核心处理字段
//有待完善
$ctemp[$i]=str_replace(#br#,
,$ctemp[$i]);
$ctemp[$i]=ltrim($ctemp[$i]);
$ctemp[$i]=ereg_replace([ f ]{0,},,$ctemp[$i]);
while (substr(trim($ctemp[$i]),0,4)==
){
$ctemp[$i]=trim(substr(trim($ctemp[$i]),4));
}
if (strlen($ctemp[$i])>20)
$end.=$ctemp[$i];
}
$handle=fopen($path2,w);
fwrite($handle,$end);
fclose($handle);
}
function insert($path){
$d=dir($path);
while($entry=$d->read()) {
if ($entry!=.&&$entry!=..){
if (is_dir($path./.$entry)){
insert($path./.$entry);
echo $path.
;
}
if (!is_dir($path./.$entry)){
cchange($path./.$entry,$path./.$entry);
}
}
}
}
?>
注:这个程序不是万能的,一些讨厌的用网页它也奈何不了。不过我统计了一下,准确率可以达到90%。如果哪位大侠有兴趣,可以帮我改一下,或和我探讨一下怎么改才尽善尽美。我的联系方式:oicq:7750988,email:cairway@263.net.
http://www.bkjia.com/phpjc/532126.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/532126.htmltecharticle做网站资料少了可是不得了的事情。在别的网站用webzip等抓下来的网页没有经过处理应该是不能用的。我们想要的文章就在其中,怎么样想...
