通過自己寫的方法解決以下的問題:
function _encode($arr) { $na = array(); foreach ( $arr as $k => $value ) { $na[_urlencode($k)] = _urlencode ($value); } return addcslashes(urldecode(json_encode($na)),"\r\n"); } function _urlencode($elem) { if(is_array($elem)){ foreach($elem as $k=>$v){ $na[_urlencode($k)] = _urlencode($v); } return $na; } return urlencode($elem); }