Home >Backend Development >PHP Tutorial >I will arrest you without any negotiation_PHP Tutorial
It’s a big deal if you don’t have enough information when making a website. Web pages captured using webzip from other websites should not be usable without processing. The article we want is among them. How can we think of a solution? Since I am relatively lazy, I have never thought about manually processing each step one by one. But the network still had to be built, and I had no choice but to compile a PHP program, which might be able to complete this task. :)
The following is the source code for your reference:
//php multi-layer file automatic file conversion system.
//Applicable to continuous files.
//Parameter description
//$site directory to be processed
$site="d:/update";
insert($site);
function cchange($path1,$ path2){
$lastchar="";
$temp=file($path1);
for ($i=0;$i
","#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
//To be improved
$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);
}
}
}
}
?>
Note : This program is not omnipotent, and it cannot solve some annoying web pages. However, I have calculated that the accuracy can reach 90%. If any heroes are interested, you can help me change it, or discuss with me how to do it. The changes are perfect. My contact information: oicq:7750988, email:cairway@263.net.