Sometimes we need to keep the get and post parameters on the next page or on other uses!
The convenience of work so I wrote this code!
I hope you have a lot of communication!
/*
Program Design: Lin Jianxui (Maple design Room)
Made in Zhuhai by 2007-03-24
qq:5818500
Email:linzhenxuan@163.com
Do not delete this copyright information
Purpose: Preserve and modify get and Post parameters
*/
function Getplus ($x =, $value =, $plus =close, $method =all) {
Global $_get,$_post;
$array = Array ();
if ($method ==all) {
$array [] = $_get; $array [] = $_post;}
ElseIf ($method ==get) {$array [] = $_get;}
ElseIf ($method ==post) {$array [] = $_post;}
$a = $_get;
$i = 1;
$true = 0;
foreach ($array as $k = = $a) {
foreach ($a as $b = = $c) {
if ($b = = $x) {
$c = $value;
$true = 1;//found.
$true 2 = 1;
}
if ($plus ==close) {
if ($i ==1) {
$temp. = "? $b = $c";
}else{
$temp. = "& $b = $c";
}
}else{
if ($i ==1) {
if ($true 2!=1) {$temp. = "? $b = $c";} else{$temp. = "?"; Unset ($true 2);}
}else{
if ($true 2!=1) {$temp. = "& $b = $c";} Else{unset ($true 2);}
}
}
$i + +;
}
}
if ($true ==0) {
if (Strpos ($temp, "?") >0 | | Strpos ($temp, "=") >0) {
$temp. = "& $x = $value";
}else{
$temp. = "? $x = $value";
}
}
ElseIf ($true ==1 && $plus!=close) {
if (Strpos ($temp, "?") >0 | | Strpos ($temp, "=") >0) {
$temp. = "& $x = $value";
}else{
$temp. = "? $x = $value";
}
}
return $temp;
}
?>
Like the original
GET:? method=1&a=1&b=2
post:y=2007&m=03
Used a
Then show
? method=1&a=1&b=2&y=2007&m=03&c=3
Used a
Then show
? method=1&b=2&y=2007&m=03&a=3
Dragged the a=3 to the last side.
I used it to combine with JavaScript.
Previous page
I feel very good!
There may be a bug to write not found it!
I hope you will mention a lot!
http://www.bkjia.com/PHPjc/508239.html www.bkjia.com true http://www.bkjia.com/PHPjc/508239.html techarticle Sometimes we need to keep the get and post parameters on the next page or on other uses! The convenience of work so I wrote this code! I hope you have a lot of communication!? /* Program Design ...