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

php二维数组转成字符串示例_PHP

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

代码如下:
function arr2str ($arr)
{
foreach ($arr as $v)
{
$v = join(",",$v); //可以用implode将一维数组转换为用逗号连接的字符串
$temp[] = $v;
}
$t="";
foreach($temp as $v){
$t.="'".$v."'".",";
}
$t=substr($t,0,-1);
return $t;
}

人气教程排行