ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
| 二维数组转化为字符串 | | | --- | --- | ``` /** * [ugcode_vod 字符串编码转换] * @param integer $type [0为UTF-8转GB2312,1为GB2312转UTF-8] * @param string $str [要转换的字符串] * @return [type] [返回转换之后的字符串] */ function ugcode_vod($str='', $type=0) { if($type=='1'){ $str = mb_convert_encoding($data,"GB2312","UTF-8"); $result= iconv("GB2312","GB2312",$str); }else{ $str = mb_convert_encoding($data,"UTF-8","GB2312"); $result= iconv("UTF-8","UTF-8",$str); } return $result; } #Example $arr = [ ['name' => 'tom', 'age' => 19], ['name' => 'jar', 'age' => 19], ['name' => 'php', 'age' => 19] ]; arr_to_str($arr) #输出tom,19,jar,19,php,19 ```