如何从URL中隐藏GET参数 [英] How to hide GET parameter from URL
问题描述
使用.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屋!