duandun3178 2014-04-04 11:14
浏览 22
已采纳

PHP使用GET []从URL获取值[关闭]

I am trying to develop products filters for an online store I am working on. An example of what I mean is http://www.riverisland.com/men/just-arrived. I have managed to get a JavaScript to populate the URL when the sizes are clicked on but failed to get them remove value from URL when unchecked.

My main question here is this. Assuming I have my URL as:

http://127.0.0.1/shop/dresses/?s=1&s=2&s=3

How do I get my PHP to extract the values from the URL? How do I format a SQL query to search the values gotten from the URL using any sample query?

  • 写回答

2条回答 默认 最新

  • dongyu6276 2014-04-04 12:25
    关注

    An easier solution is this.

    Format your URL like http://127.0.0.1/shop/dresses/?s=1,2,3 as suggested by @Andrey.Popov. Then do the below.

    if(isset($_GET['s']) && !empty($_GET['s']))
    {
        $e = sanitizeFunction($_GET['s']);
        $d=explode(',',$e);
    }
    

    $d now has all your $_GET['s'] values.

    That's the easier way I have figured out and it works!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题