dongmaoluan5719 2012-04-09 12:57 采纳率: 100%
浏览 678
已采纳

从调用当前页面的页面获取URL

I have an error page which, I would like to call from more than one pages in my site. In this error page, I pass a message(using the url for now), but I would also like to pass a link of a page too.

The error page will use this link to redirect the user to the page I want. I have thought to pass the link using sessions or having a form(method post) with hidden input. Which one is better? And is there any other way to do that?

Thank you in advance!

  • 写回答

4条回答 默认 最新

  • dongqia3502 2012-04-09 13:01
    关注

    You're looking for $_SERVER['HTTP_REFERER']; which is one of PHP's $_SERVER predefined variables...

    More can be read here

    tl;dr

    HTTP_REFERER

    The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料