How to redirect to the same page in PHP

前端 未结 9 1646
春和景丽
春和景丽 2020-12-01 03:46

How can I redirect to the same page using PHP?

For example, locally my web address is:

http://localhost/myweb/index.php

How can I r

相关标签:
9条回答
  • 2020-12-01 04:23

    A quick easy approach if you are not concerned about query params:

    header("location: ./");
    
    0 讨论(0)
  • 2020-12-01 04:26

    I just tried using header("Location: "); (without any value) and it redirected to the current page.

    0 讨论(0)
  • 2020-12-01 04:27

    Simple line below works just fine:

    header("Location: ?");
    
    0 讨论(0)
提交回复
热议问题