当我打印时,我得到的结果如下Array ( [0] => Array ( [subscription_email] => example@gmail.com ) [1] => Array ( [subscription_email] => test@gmail.com ) )但我想得到它example@gmail.com, test@gmail.com这是我的结果代码$data['subscribers'] = $this->Admin_model->getSubscribers();
$to_email = $data['subscribers'];
1 回答
蝴蝶刀刀
TA贡献1801条经验 获得超8个赞
您可以简单地循环遍历数组并将每个值添加到变量中。数组或字符串:
<?php
$dataset = $this->Admin_model->getSubscribers();
$outputArray = [];
foreach($dataset as $row) {
$outputArray[] = $row['subscription_email'];
}
// in case you wish for an array
$to_email = $outputArray;
// in case you need a comma separated string:
$to_email = implode(',', $outputArray);
?>
- 1 回答
- 0 关注
- 86 浏览
添加回答
举报
0/150
提交
取消