drd43058 2014-02-19 20:46
浏览 120
已采纳

隐藏URL中的参数供用户查看

I was just wondering if there is any possible way of getting rid of the parameters in a link. For example, I have this redirecting the user back to the original form if any errors come up:

www.mywebsite.com/form.php?error_code=1021

But I don't want the user to see the error_code=1021.

How would I code it in PHP so that after it redirect to the page with the error, it looks like this to the user:

www.mywebsite.com/form.php
  • 写回答

4条回答 默认 最新

  • douyue2313 2014-02-19 20:49
    关注

    You can take the advice in the comments and not redirect, or if you must, I would use sessions:

    session_start();
    $_SESSION['error_code'] = '1021';
    header('Location: http://www.mywebsite.com/form.php');
    exit;
    

    Then in the form you would need session_start() and then access $_SESSION['error_code'].

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

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么