将 $_GET 变量转换为 $_POST 并重定向页面
我通过 $_GET 在电子邮件中读取的链接发送信息(即电子邮件中的链接格式为 http:// website.com?dogs=cats")。但我希望网站 URL 不包含可见的附件。所以我尝试过:
- 链接到将 $_GET 保存在隐藏表单字段中的页面,然后自动保存提交表单的问题是;按钮然后返回到该中间页面
- 与上面相同,在新选项卡中打开中间页面,然后让表单加载另一个新选项卡(_blank),然后自行关闭;除了在 IE 中,这些是窗口,这很烦人
我'我正在考虑将 $_GET 结果保存在 cookie 中,然后使用 header() 重定向页面,然后提取数据并使 cookie 过期。
是否有一种我忽略的更简单的方法?
I'm sending info through a link read in an email via $_GET (i.e. link in email is in form http://website.com?dogs=cats"). But I want the site URL to not have the appendages visible. So I've tried:
- Linking to a page which saves the $_GET in a hidden form fields, then automatically submits the form; problem is that the back button then leads back to this intermediary page
- Same as above, opening intermediary page in new tab, then having the form load another new tab (_blank), and closes itself; works fine, except in IE these are windows, which are annoying
I'm considering saving the $_GET results in a cookie, then redirecting the page with a header(), then extracting data and expiring the cookie.
Is there an easier way that I'm overlooking?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
启动一个会话并将它们存储到 $_SESSION 变量怎么样?
How about starting a session and storing them to the $_SESSION variables?
以下是如何在链接上创建隐藏参数的示例实现。这会在链接上设置一个自定义处理程序,该处理程序会将隐藏参数复制到表单中并通过 post 请求发送。它不能替代会话,但它可以有自己的用途。
Here is a sample implementation of how you can make a hidden arguments on links. This sets a custom handler on the links which will copy hidden argument into the form and send it through post request. It is not a substitute to the session, but it can have it's own uses.