时间:2021-07-01 10:21:17 帮助过:667人阅读
$a = array("123","321","111");$s = "'" . join("','", $a) . "'";echo $s;'123','321','111'
$arr = array("123","321","111");$str = "'" . implode("','", string) . "'";
或者这样也可以
$arr = array("123","321","111");foreach($arr as &$v) $v = "'$v'";echo implode(',', $arr);
还可以这样
$a = array(1,2,3,4);echo join(',', array_map(function($v) {return "'$v'";}, $a));'1','2','3','4'