0
$arr = array('key1'=>'val1','key2'=>'val2');
$str = '';
foreach($arr as $k=>$v)
{
$str .= '&' . $k . '=' . urlencode($v);
}
echo substr($str,1);
$arr = array('key1'=>'val1','key2'=>'val2');
$str = '';
foreach($arr as $k=>$v)
{
$str .= '&' . urlencode($k) . '=' . urlencode($v);
}
echo substr($str,1);
是否$k
需要進行url編碼?