我在下面的php文件中有這段代碼。 問題是我得到超過120秒的錯誤最大執行時間。我無法弄清楚這個問題,但我認爲這可能與我做循環的方式有關。如果我這樣做的方式不好,請提前諒解。PHP循環最大執行時間
<?php
for ($i=0;$i<168;$i++) {
$answers[$i] = (int)$data[6+$i];
}
$A = $B = $C = $D = $E = $F = $G = $H = $I = $J = $K = $L = $M = $N = 0;
for ($z=0;$z<168;$z+14) {
$A = $A + $answers[0+$z];
$B = $B + $answers[1+$z];
$C = $C + $answers[2+$z];
$D = $D + $answers[3+$z];
$E = $E + $answers[4+$z];
$F = $F + $answers[5+$z];
$G = $G + $answers[6+$z];
$H = $H + $answers[7+$z];
$I = $I + $answers[8+$z];
$J = $J + $answers[9+$z];
$K = $K + $answers[10+$z];
$L = $L + $answers[11+$z];
$M = $M + $answers[12+$z];
$N = $N + $answers[13+$z];
}
echo "<table border='1'>";
echo "<tr><td>A</td><td>" . $A . "</td></tr>";
echo "<tr><td>B</td><td>" . $B . "</td></tr>";
echo "<tr><td>C</td><td>" . $C . "</td></tr>";
echo "<tr><td>D</td><td>" . $D . "</td></tr>";
echo "<tr><td>E</td><td>" . $E . "</td></tr>";
echo "<tr><td>F</td><td>" . $F . "</td></tr>";
echo "<tr><td>G</td><td>" . $G . "</td></tr>";
echo "<tr><td>H</td><td>" . $H . "</td></tr>";
echo "<tr><td>I</td><td>" . $I . "</td></tr>";
echo "<tr><td>J</td><td>" . $J . "</td></tr>";
echo "<tr><td>K</td><td>" . $K . "</td></tr>";
echo "<tr><td>L</td><td>" . $L . "</td></tr>";
echo "<tr><td>M</td><td>" . $M . "</td></tr>";
echo "<tr><td>N</td><td>" . $N . "</td></tr>";
echo "</table>";
echo "<br>";
增加超時或禁用此代碼 - '的set_time_limit(240)'或'的set_time_limit (0)'〜其中'0'表示沒有限制 – RamRaider
所以這意味着我真的必須等待它完成?沒有辦法讓它加載「即時」? :( – rekt