//先将字符串按行分割成数组 $str_arr = explode("\n", $aa); foreach ($str_arr as $str) { //再将每一行按逗号分割成数组 $arr = explode(",", $str); //输出数组中的元素,用空格隔开 echo implode(",", $arr) . "
"; }

PHP 字符串处理:将多行字符串按逗号分割并格式化输出

原文地址: https://www.cveoy.top/t/topic/oijf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录