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

我是研究僧i 提交于 2019-12-01 16:13:02

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!