试试这个 :
<?php
function parseQueryString($str)
{
$op = array();
$pairs = explode("&", $str);
foreach ($pairs as $pair)
{
list($k, $v) = array_map("urldecode", explode("=", $pair));
$op[$k] = $v;
}
return $op;
}
$str = "SessionID=582506&Note=joe@bloggs.com;joe bloggs;111.111.111.111&Status=203";
$p = parse_url($str);
$s = parseQueryString($p['path']);
print_r($s);
?>
输出 :
Array
(
[SessionID] => 582506
[Note] => joe@bloggs.com;joe bloggs;111.111.111.111
[Status] => 203
)
至于Note
变量:
<?php
$notes = explode(";", $s['Note']);
$email = $notes[0];
$name = $notes[1];
$ipaddress = $notes[2];
?>