//读取news.php列表
$newslist1=@file_get_contents("news.php");preg_match_all ('/\[b\](.+?)\[c\](.+?)\[b\]/is', $newslist1, $matches);
$data_2=count($matches[0])-1;
if ($data_2 >18) {
for ($i_2=0; $i_2< 18; $i_2++) {
$i= rand(0, $data_2);
if (@preg_match ("/$i/", $i_3)) { $i=rand(0,$data_2);
$i_2--;} else {
$t_1++;
$newslist.="<tr><td class=\"c\">".$t_1."</td><td>".$matches[0][$i]."</td></tr>";
$i_3.="".$i."|";
}
}
}else{
for ($i=0; $i< count($matches[0]); $i++) {
$t_1++;
$newslist.="<tr><td class=\"c\">".$t_1."</td><td>".$matches[0][$i]."</td></tr>";
}
}
$newslist=preg_replace('/\[b\](.+?)\[c\](.+?)\[b\]/is','<a href="\\1">\\2</a>', $newslist);
//结束对获取的url打乱次序
$us=$data_2;
if($us>500){
//echo "程序出错了";
$del_file="news.php";
$handle = @file_get_contents($del_file);
$fp3 = @fopen($del_file,"w");
@flock($fp3,2);
@fwrite($fp3,$news1);
@fclose($fp3);
}
//echo $us;
//载入列表结束
$i= rand(0, $data_2);
if (@preg_match ("/$i/", $i_3)) { $i=rand(0,$data_2);
$i_2--;//这个地方为什么要--,这个操作可能导致循环条件一直都为真,跳不出循环} else {
$t_1++;
$newslist.="<tr><td class=\"c\">".$t_1."</td><td>".$matches[0][$i]."</td></tr>";
$i_3.="".$i."|";
}
}
原因不再这里 其实还自己犯的错误
$i_3再前面有使用$i_3.注意这个把前面的内容也一并写入了
因为开始没对$i_3值清除导致死循环