PHP refresh window? equivalent to F5 page reload?

前端 未结 10 2522
后悔当初
后悔当初 2021-01-01 23:45

Is there anything in PHP that is the equivalent of manually pressing the F5 page reload button? My php script is in a frame and isn\'t the parent script but it needs to ref

相关标签:
10条回答
  • 2021-01-02 00:24

    Use JavaScript for this. You can do:

    echo '
    <script type="text/javascript">
       parent.window.location.reload(true);
    </script>
    ';
    

    In PHP and it will refresh the parent's frame page.

    0 讨论(0)
  • 2021-01-02 00:25

    Actually it is possible:

    Header('Location: '.$_SERVER['PHP_SELF']);
    Exit(); //optional
    

    And it will reload the same page.

    0 讨论(0)
  • 2021-01-02 00:25
    <?php 
    echo "<script>window.opener.location.reload();</script>";
    echo "<script>window.close();</script>";
    ?>
    
    0 讨论(0)
  • 2021-01-02 00:28

    With PHP you just can handle server-side stuff. What you can do is print this in your iframe:

    parent.window.location.reload();
    
    0 讨论(0)
提交回复
热议问题