如何在PHP中从URL(GET)中删除和替换参数 [英] How to remove and replace parameter from URL (GET) in PHP
问题描述
您好,
所以,假设我有这样的链接: www.mywebsite / products / index.php?p = 545
我想要的是这个链接: www.mywebsite / products / nameofproduct
所以在这里你看,当我点击特定产品的图片时,我的网站显示了一些产品,它重定向到上面的链接。你知道怎么做吗?
这是第一个链接的php代码。
查询(SELECT * FROM。$ TB_PRODUCTS。WHERE。$ PAYS。='1'AND Code ='。$ Format1。'); while($ dataF = $ Stat-> fetch(PDO :: FETCH_ASSOC)){
< a href = < span class =code-keyword> index.php?p =%3C?php%20echo%20 $ dataF [ > >
< / a >
我尝试过:
我读到了关于.htaccess的mod重写,但我从未使用过htaccess。
TB_PRODUCTS。 WHERE。
PAYS。='1'AND Code ='。
Format1。'); while(
Hello,
So, let say that I have a link like this: www.mywebsite/products/index.php?p=545
What i want is to have this link : www.mywebsite/products/nameofproduct
So here as you see, my webiste is showing some products when I click in a picture of a specific product it redirect to the link above. Do you have any idea how to do it ?
Here is the php code for the first link.
query("SELECT * FROM ".$TB_PRODUCTS." WHERE ".$PAYS."='1' AND Code = '".$Format1."' "); while($dataF = $Stat->fetch(PDO::FETCH_ASSOC)){
<a href="index.php?p=%3C?php%20echo%20$dataF[">">
</a>
What I have tried:
I read about mod rewrite of the .htaccess but I never used htaccess.
TB_PRODUCTS." WHERE ".
PAYS."='1' AND Code = '".
Format1."' "); while(
这篇关于如何在PHP中从URL(GET)中删除和替换参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!