douxian7808 2013-03-23 20:20
浏览 61
已采纳

使用$ _GET获取我的链接的ID

lets say i have a link like that

http://www.example.com/d8ed54

d8ed54 is the id

How i can use $_GET to echo the id

Thank you

Update........

Not possible in my case to use .htaccess RewriteRule because it's already have a one for all the script links..i can't play on it.

However the link http://www.example.com/d8ed54 will work without 404

I need something with php

  • 写回答

2条回答 默认 最新

  • dqr91899 2013-03-23 20:23
    关注

    put the following in htaccess

    RewriteRule (.*) index.php?id=$1
    

    and then you can use $_GET['id'] to get whatever is passed after the /

    you can also do this without $_GET and without any extra additions to your htaccess, you can use $_SERVER['REQUEST_URI'] to get the same piece of information.

    $id = $_SERVER['REQUEST_URI'];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程