[PHP]代码
01 |
02 | function _encode( $arr ) |
03 | { |
04 | $na = array (); |
05 | foreach ( $arr as $k => $value ) { |
06 | $na [_urlencode( $k )] = _urlencode ( $value ); |
07 | } |
08 | return addcslashes (urldecode(json_encode( $na )), "\r\n" ); |
09 | } |
10 |
11 | function _urlencode( $elem ) |
12 | { |
13 | if ( is_array ( $elem )){ |
14 | foreach ( $elem as $k => $v ){ |
15 | $na [_urlencode( $k )] = _urlencode( $v ); |
16 | } |
17 | return $na ; |
18 | } |
19 | return urlencode( $elem ); |
20 | } |