function to_urlencode(&$arr){//Solve the problem of Chinese garbled characters in the array when the array is converted to an object foreach($arr as $key => $value){ if(is_array($value)){ to_urlencode($arr[$key]); }else{ $arr[$key] = urlencode($value); } }
If $arr is a two-digit array, the conversion between array and object generally requires the following operations:
to_urlencode($arr); $arr_json = json_encode($arr); $arr_json = urldecode($arr_json);