简体   繁体   English

如何从PHP请求中获取引用文件名

[英]How to get the referring filename from a request in PHP

I'm building the finishing touches on the registration aspect of my web application and am scratching my head on how I'm going to display a "success" message. 我正在对我的Web应用程序的注册方面进行画龙点睛,并在我将如何显示“成功”消息方面scratch之以鼻。

I've decided that I will redirect using: 我决定我将使用重定向:

header("Location: account.php", true, 303);

Once I've done that, I've decided to check the referring filename (and GET variable) to make sure it came from "account.php?action=processregister". 完成此操作后,我决定检查引用文件名(和GET变量)以确保它来自“ account.php?action = processregister”。

I'm wondering, how might I write code to retrieve the filename (and variables) that processed the redirect? 我想知道,如何编写代码来检索处理重定向的文件名(和变量)?

If you require more information, such as code, feel free to ask. 如果您需要更多信息,例如代码,请随时询问。

UPDATE UPDATE

Found this after some digging on Google, could be useful to other askers: https://github.com/plasticbrain/PHP-Flash-Messages 在Google上进行一些挖掘后发现了这一点,可能对其他询问者有用: https : //github.com/plasticbrain/PHP-Flash-Messages

To get the refferer $_SERVER['HTTP_REFERER']; 获取代理$_SERVER['HTTP_REFERER']; from here http://php.net/manual/en/reserved.variables.server.php 从这里http://php.net/manual/en/reserved.variables.server.php

For your question, i think you need to store some data in $_SESSION. 对于您的问题,我认为您需要在$ _SESSION中存储一些数据。

For example, $_SESSION['flash-message'] = 'Registration done successefull!' 例如, $_SESSION['flash-message'] = 'Registration done successefull!' ; ;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM