http://pastebin.com/MFCQzJQ8
我有这个代码,我试图让它输出结果
echo $attack.' Attacks Have Been Stopped On Server '.$id.'<br>';
每次都不同,但我只能获得服务器ID或攻击改变,但我需要在新线路上更改和输出。
http://gyazo.com/f38c20ecef5af72dcc534be88101f8a2
<?php
if (isset($_POST['stop']))
{
$ids = $_POST['id'];
$urls = $_POST['url'];
$attacks = $_POST['attack'];
foreach($urls as $url);
foreach($attacks as $attack);
foreach($ids as $id);
echo '<div class="nNote nSuccess hideit"><p><strong>SUCCESS: </strong><br>';
foreach($ids as $id){
if($attack == "NONE"){$attack = "No";}
echo $attack.' Attacks Have Been Stopped On Server '.$id.'<br>';
}
echo '</p></div>';
}
?>
答案 0 :(得分:1)
您可以将数组合并为一个并迭代它:
foreach(array_map(null,$ids,$urls,$attacks) as list($id,$url,$attack)) {
// code body here
}