呼唤远方
JS使用替换功能。let str='A1780G1100001 A1780G1100002 A1780G1100003';str = str.replace(/\s+/g, ',');console.log(str); // "A1780G1100001,A1780G1100002,A1780G1100003"PHP使用str_replace或preg_replace$str = 'A1780G1100001 A1780G1100002 A1780G1100003';$res = str_replace(' ', ',', $str);echo $res; // "A1780G1100001,A1780G1100002,A1780G1100003"echo "\n";$res = preg_replace('/\s+/', ',', $str);echo $res; // "A1780G1100001,A1780G1100002,A1780G1100003"