dr897777 2011-08-30 23:26
浏览 20
已采纳

完成加载后页面刷新,加起来变量

$test = $_GET['nr'];
    $class = new class;
    echo $class->function($test);

I want $test to increase after it have fully loaded the page.

The problem is, I don't know how. Looping $test normally will show me a lot of errors. like function cannot be declared again I've have the same functions names with different functionality. And it's pretty long code.

Anyone have any idea how I can do this? Thanks.

EDIT:

When the page is fully loaded, I want it to add + 1 to $test and then refresh it with the new variable.

I can do this manually by:

$next = $test + 1;
    echo "<a href='/index.php?nr=". $next . "'>Next page</a>";
  • 写回答

1条回答 默认 最新

  • dongmi5607 2011-08-30 23:54
    关注

    If you are storing the page in a string variable and outputting at the end you can just do a meta refresh:

    $next = $test + 1;
    echo "<meta http-equiv=\"refresh\" content=\"5; url=/index.php?nr=$next\">";
    

    ...will refresh the page 5 seconds after loading completes.

    Failing that, you can do a simple javascript refresh:

    $next = $test + 1;
    echo "<script type=\"text/javascript\">
    function reloadPage() {
    window.location.href = '/index.php?nr=$next';
    }
    setTimeout(reloadPage,5000);
    </script>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)