如何从URL中隐藏GET参数 [英] How to hide GET parameter from URL

查看:126
本文介绍了如何从URL中隐藏GET参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用.Htaccess可以隐藏来自url(rozgaarexpress.com/profile.php?id=22)的获取值。我想隐藏?id = 22。
然后URL看起来像rozgaarexpress.com/profile.php

 我的第一页demo.php 


我只是通过这个URL

< a href =profile.php?id = 22> HTACCESS< / a>

第二页profile.php
<?php
$ id = $ _ GET ['id'];
echo $ id;
?>


解决方案

无法隐藏ID参数,即使您可以使用 .htaccess 来实现该功能。我的意思是你可以做到这一点,但你可以在访问profile.php页面时使用单一的ID,我认为这不是你想要的。



你可以通过使用如下会话来做到这一点:

demo.php

 在session_start(); 

$ _SESSION ['id'] = 22;

echo'< a href =profile.php>我的个人资料< / a>';

profile.php

  session_start(); 

echo $ _SESSION ['id'];


It is possible to hide get value from url (rozgaarexpress.com/profile.php?id=22) using .Htaccess.I want to hide ?id=22. Then URL Looks like rozgaarexpress.com/profile.php

My first page demo.php


I am just passing this url

<a href="profile.php?id=22">HTACCESS</a> 

second page profile.php
<?php
$id=$_GET['id'];
echo $id;
?> 

解决方案

You can't hide the ID parameter, even if you use .htaccess to achieve that. I mean you can do it but you will be able to use a single ID when accessing profile.php page which I don't think is the case you want.

You can do it by using sessions like:

demo.php

session_start();

$_SESSION['id'] = 22;

echo '<a href="profile.php">My profile</a>';

profile.php

session_start();

echo $_SESSION['id'];

这篇关于如何从URL中隐藏GET参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆