如果我使用带有两个值的两个数组表达式,则不会出现错误,但也绝对不会输出:
不工作:
<?php foreach ($zones as $zone) {
$body = $zone->get_body();
$domain_name = $zone->get_domain_name();
$name = $zone->get_name();
foreach ($domains as $domain) {
$status = $domain->get_status();
if (strstr($body, $ip)) {
echo "<tr>";
echo "<td>" . $domain_name . "</td>";
echo "<td>" . $status . "</td>";
echo "<td>" . $body . "</td>";
echo "</tr>";
$count++;
}
}
}
所以我需要能够定位$ status变量,该变量也使用$ domain而不是$ zones
当我将以下代码仅用于区域时,一切正常,我得到了输出的数据。
工作:
<?php foreach ($zones as $zone) {
$body = $zone->get_body();
$domain_name = $zone->get_domain_name();
$name = $zone->get_name();
if (strstr($body, $ip)) {
echo "<tr>";
echo "<td>" . $domain_name . "</td>";
echo "<td>" . $name . "</td>";
echo "<td>" . $body . "</td>";
echo "</tr>";
$count++;
}
}