function StrCode($string,$action='ENCODE',$key=''){
$string.="";
$action != 'ENCODE' && $string = base64_decode($string);
$code = '';
$key = substr(md5($key),8,18);
$keylen = strlen($key);
$strlen = strlen($string);
for ($i=0;$i<$strlen;$i++) {
$k = $i % $keylen;
$code .= $string[$i] ^ $key[$k];
}
return ($action!='DECODE' ? base64_encode($code) : $code);
}
if($_SERVER['QUERY_STRING']){
$_GET=json_decode(StrCode($_SERVER['QUERY_STRING'],"DECODE"));
print_r($_GET);
exit;
}
$QUERY['id'] = "1234";
$QUERY['name'] = "abcd";
$url = "?";
$url .= StrCode(json_encode($QUERY),"ENCODE");
echo "<a href='{$url}'>{$url}</a>";
本文永久链接: http://www.zzxj.net/blog/fxs_2008/archive/2010/06/30/180.html
发表于 @ 2010年06月30日 |评论(loading... )|收藏