当前位置:Gxlcms > PHP教程 > php二维数组转换为字符串示例

php二维数组转换为字符串示例

时间:2021-07-01 10:21:17 帮助过:29人阅读

  1. function arr2str ($arr)
  2. {
  3. foreach ($arr as $v)
  4. {
  5. $v = join(",",$v); //可以用implode将一维数组转换为用逗号连接的字符串
  6. $temp[] = $v;
  7. }
  8. $t="";
  9. foreach($temp as $v){
  10. $t.="'".$v."'".",";
  11. }
  12. $t=substr($t,0,-1);
  13. return $t;
  14. }

人气教程排行