-2

I would like to know what page redirected to the current page on my system.

For example. If the system stopped in the page current.php. How to know what page called current.php?

Is there a function to perform this?

4

3 回答 3

5

$_SERVER['HTTP_REFERER'] can contain the URL of the page the user agent was previously on, but it can be spoofed or empty.

于 2012-09-25T20:49:10.860 回答
0

You don't have a reliable way of doing that.

If you're expecting the redirecting page to be on your server, you can set a $_SESSION variable to the current page on every page you visit, that way, you can check for it on the next page (before resetting it of course).

于 2012-09-25T20:48:53.150 回答
0

Maybe there are better solutions, but you could use a hidden field inside a form to transfer this information between pages inside your system, or use GET vars in your URL. Rhis way you can keep track of certain states during page changes, that u are interested in. But u would also need to update every page to handle the additional variables.

于 2012-09-25T20:58:41.317 回答