dsux90368 2014-11-25 22:40
浏览 25
已采纳

我的服务器在for循环中给我一个超时消息

I have a form in page1.php that has some checkboxes in it:

<form method="POST" action="page2.php">
<input type="checkbox" name="F10">
<input type="checkbox" name="W10">
<input type="checkbox" name="F20">
<input type="checkbox" name="W20">
<input type="checkbox" name="F30">
<input type="checkbox" name="W30">
<input type="checkbox" name="F11">
<input type="checkbox" name="W11">
<input type="checkbox" name="F21">
<input type="checkbox" name="W21">
<input type="checkbox" name="F31">
<input type="checkbox" name="W31">
<input type="checkbox" name="F12">
<input type="checkbox" name="W12">
<input type="checkbox" name="F22">
<input type="checkbox" name="W22">
<input type="checkbox" name="F32">
<input type="checkbox" name="W32">
</form>

page2.php

<?php 
$g=0;
$coursesD= array();
    for($f=1;$f++;$f<4){
        for($l=0;$l++;$l<3){
            if(isset($_POST["F".$f.$l])){
                $coursesD[$g]=$_POST["F".$f.$l];
                $g++;
            }
            if(isset($_POST["W".$f.$l])){
                $coursesD[$g]=$_POST["W".$f.$l];
                $g++;
            }
        }
    }
?>

But after I submit the form it start loading and then it displays this message:

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\4\page2.php on line 5

Please Help me

  • 写回答

1条回答 默认 最新

  • douhuang9886 2014-11-25 22:44
    关注

    you for loops are in the wrong order

    its supposed to be

    for(starting condition;loop condition;after each loop){
    

    yours have the last 2 in the wrong order so f++ is aways true, therefore will loop forever (and cause a timeout)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器