$value) { $j[]=str_replace('\r\n', "", trim($value)); } $zong_juzi=count($j); $juzi=array(); for ($i=0; $i < $a; $i++) { $juzi[$i]=$j[mt_rand(0,$zong_juzi-1)]; } array_filter($juzi); return $juzi; } function suiji($len) { $chars_array = array( "0","1","2","3","4","5","6","7","8","9" ); $charsLen = count($chars_array) - 1; $outputstr = ""; for ($i=0; $i<$len; $i++) { $outputstr .= $chars_array[mt_rand(0, $charsLen)]; } return $outputstr; } // 随机取外链 $wailian=duqu('lunlian.txt',20); $xiaoshuo=duqu('content.txt',40); // 随机取关键词 $keyword=duqu('key.txt',20); // 再次取关键词 $keyword1=duqu('key.txt',40); // 取标题 $title=duqu('key.txt',1); // 取描述 $des=duqu('key.txt',8); // 组装外链文章 $lunlian=array(); foreach ($wailian as $key => $v) { $lunlian[]="".$keyword[$key].""; } // 组装内链文章 if($fix!=''){ $slink=array(); foreach ($keyword1 as $key => $v) { $slink[]="".$v.""; } }else{ $slink=array(); foreach ($keyword1 as $key => $v) { $slink[]="".$v.""; } // 之前路径为 $v) { $moban=preg_replace('/\{juzi\}/', $v, $moban,1); } echo $moban; ?>