dsafew1231 2018-03-22 17:50
浏览 36
已采纳

在PHP中,在引用href导航到下一页时,页面名和参数应该用输入参数替换

I have a requirement in my project where in on click of read more button it should navigate to that particular product page.

I have my code for like this

<div class="button">
    <a href="single.php?eid=<?php echo $deals['property_title']; ?>" class="button-primary"> <span>read more</span>
        <div class="button-triangle"></div>
        <div class="button-triangle2"></div>
        <div class="button-icon"><i class="fa fa-search"></i></div>
    </a> 
</div>

Now my requirement is instead of "https://www.example.com/single.php?eid=example", it should be displayed as "http://www.example.com/example". Which means the part single.php?eid= should be replaced with the actual parameter that we are passing to that page.

</div>
  • 写回答

1条回答 默认 最新

  • douzang7928 2018-03-22 19:09
    关注

    You can use mod_rewrite in your .htaccess file.

    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteRule ^(.*)$ single.php?eid=$1
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计