postgetphp:PHP程序处理网页表单的GET和POST思路方法另外使用方法来源: 发布时间:星期二, 2008年12月30日 浏览:17次 评论:0
有时候我们需要保留GET和POST参数在下页或者其他用途上传递!
代码! 希望大家多多交流! <? /* 设计: 林建炫(飘枫设计室) made in 珠海 by 2007-03-24 QQ: 5818500 Email:[email protected] 请勿删除该版权信息 用途:保留和修改GET和POST参数 */ function getplus($x='',$value='',$plus='close',$method='all'){ Global $_GET,$_POST; $.gif' /> = .gif' />; ($method'all'){ $.gif' /> = $_GET;$.gif' /> = $_POST;} ($method'get'){$.gif' /> = $_GET;} ($method'post'){$.gif' /> = $_POST;} $a = $_GET; $i = 1; $true = 0; foreach($.gif' /> as $k => $a){ foreach($a as $b => $c){ ($b$x){ $c = $value; $true = 1;//找到啦 $true2 = 1; } ($plus'close'){ ($i1){ $temp .= "?$b=$c"; }{ $temp .= "&$b=$c"; } }{ ($i1){ ($true2!=1){$temp .= "?$b=$c";}{$temp.="?";un($true2);} }{ ($true2!=1){$temp .= "&$b=$c";}{un($true2);} } } $i; } } ($true0){ (strpos($temp,"?")>0 || strpos($temp,"=")>0){ $temp .= "&$x=$value"; }{ $temp .= "?$x=$value"; } } ($true1 && $plus!='close'){ (strpos($temp,"?")>0 || strpos($temp,"=")>0){ $temp .= "&$x=$value"; }{ $temp .= "?$x=$value"; } } $temp; } ?> 比如原来 GET: ?method=1&a=1&b=2 POST: y=2007&m=03 用了 <?=getplus('c','3')?> 的后显示 ?method=1&a=1&b=2&y=2007&m=03&c=3 用了 <?=getplus('a','3','open')?> 的后显示 ?method=1&b=2&y=2007&m=03&a=3 把a=3拖到最后面来了 我用<?=getplus('a','','open')?>来和javascript结合 上页 自己感觉还是挺好! 可能还有写Bug没发现吧! 希望大家多多提提! 0
相关文章读者评论发表评论 |
|