从查询字符串第2部分中删除值 [英] Remove a value from a querystring Part 2

查看:73
本文介绍了从查询字符串第2部分中删除值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

扩展我的原始问题此处:我现在想删除



例如,我想删除变量 bar1 &来自查询字符串的 bar2 。我试过了下面的代码:
$ b $ pre $ echo $ parseQueryString(http://。$ _SERVER ['HTTP_HOST']。$ _SERVER [ 'REQUEST_URI'], BAR2, BAR1);

但是这并不会去除这两个变量,只有 bar2
$ p
$ b


$ b

谢谢,



Matt

解决方案

你会想要一些像



  echo parseQueryString(parseQueryString(http://。$ _SERVER ['HTTP_HOST']。$ _SERVER ['REQUEST_URI'],bar2),bar1) ; 

或者,因为我假设parseQueryString是您定义的函数,您可以更改它,一个数组参数并遍历数组。


Expanding on my original question here: I would now like to remove more than 1 variable from the querystring.

For example, I want to remove the variables bar1 & bar2 from the querystring. I have tried the following code:

echo parseQueryString("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],"bar2","bar1");

But this doesn't remove both variables, only bar2.

Any help appreciated.

Thank you,

Matt

解决方案

You'll be wanting something like

echo parseQueryString(parseQueryString("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],"bar2"),"bar1");

Alternatively, since I'm assuming parseQueryString is a function you defined, you can change it so it accepts an array argument and loops over the array.

这篇关于从查询字符串第2部分中删除值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆