PHP How to header-location to a page in a parent directory?

前端 未结 3 1428
不思量自难忘°
不思量自难忘° 2021-01-17 17:14

I have a first.php page with

header(\"Location: script/script1.php\")

and script1.php has another



        
相关标签:
3条回答
  • 2021-01-17 17:39

    You can do this. Redirects back to the Home directory (Root) in '0' seconds -

    <?php
    
         header('Refresh: 0, url = /Root_Dir/');
    
    ?>
    

    Replace the 'Root_Dir' with your directory name.

    0 讨论(0)
  • 2021-01-17 17:43

    Instead of: header("Location: ../first.php")

    try with this: header("url: ../first.php")

    this will change the url.Using location don't work in some cases

    Since: '../' is to denote 'parent directory'.So,this will work.

    0 讨论(0)
  • 2021-01-17 17:44

    have a try with this:

    header("Location: ../first.php")
    

    or use an absolute path or url instead.

    Explanation: .. is the unix/linux expression used for 'parent directory'. The Internet is unix land, so that rules applies there too.

    0 讨论(0)
提交回复
热议问题