php用更新的查询字符串重新加载页面 [英] php reload page with updated query string

查看:41
本文介绍了php用更新的查询字符串重新加载页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个这样的网址

let say I have an url like this

http://www.domain.com/myscript.php?p1=xyz&p2=10&p3=ghj

现在我想更新 p2=100 并使用 php 重新加载页面

Now i want to update p2=100 and reload the page using php

这里的参数可以是无限的(p1,p2,...pn),我们可以更新任何参数并重新加载页面.

here parameters can be unlimited (p1,p2,...pn), and we can update any param and reload the page.

推荐答案

很简单,你可以这样做

$_GET['p2'] = 100;
header("Location: http://www.domain.com" . $_SERVER['REDIRECT_URI'] . '?' . http_build_query($_GET));

这篇关于php用更新的查询字符串重新加载页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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