PHP100 2019-03-27
代码如下:
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); }