Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
a7898585
V2EX  ›  Linux

求教,php循环执行问题

  •  
  •   a7898585 · Jan 22, 2014 · 3611 views
    This topic created in 4497 days ago, the information mentioned may be changed or developed.
    通过while或者if函数设置的,对没达到要求的不断循环执行
    比如
    $i=1;
    while($i<10000)
    {
    echo ”次数为“ . $i;
    $i++;
    }
    那么我在打开php页面,在页面完成并跳出 结果之前关闭了浏览器,那么后台还会执行吗?
    9 replies    1970-01-01 08:00:00 +08:00
    shiny
        1
    shiny  
    PRO
       Jan 22, 2014
    请查看相关函数: ignore_user_abort、fastcgi_finish_request
    RobinFai
        2
    RobinFai  
       Jan 22, 2014
    修改输出为更新文件内容,然后你就知道了。
    kran
        3
    kran  
       Jan 22, 2014
    执行
    a7898585
        4
    a7898585  
    OP
       Jan 22, 2014
    @RobinFai
    <?php
    $i=1;
    while($i<999999)
    {
    $i++;
    if ($i=999998)
    {
    $file=fopen("word.txt","a");
    }
    }
    ?>
    为毛执行不下去。。。。
    Fatal error: Maximum execution time of 30 seconds exceeded in /home2/a7898585/public_html/woaixiaofeifei.com/ceshi/1.php on line 8
    Jat001
        5
    Jat001  
       Jan 22, 2014
    @a7898585 你设置了超时 30 秒……
    raincious
        6
    raincious  
       Jan 22, 2014
    @a7898585 因为超过了最大执行实践,被强制终止了。
    msg7086
        7
    msg7086  
       Jan 23, 2014
    @a7898585 因为$i 永远是999998。

    证据: $i = 999998
    picasso250
        8
    picasso250  
       Jan 23, 2014
    笑死了
    RobinFai
        9
    RobinFai  
       Mar 5, 2014
    题主在卖萌
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2878 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 10:19 · PVG 18:19 · LAX 03:19 · JFK 06:19
    ♥ Do have faith in what you're doing.