我有这个作为MySQL
(存储为$result
)的结果
+-------------------------------------------------------------------------+
| CONCAT_WS('::', p.isMobile, p.contact_phone_id, p.contact_phone_number) |
+-------------------------------------------------------------------------+
| 0::1::123 |
| 1::2::456 |
| 0::3::789 |
| 1::4::987 |
| 0::5::654 |
| 0::6::321 |
| 1::7::123 |
| 1::11::456 |
+-------------------------------------------------------------------------+
然后在一个while循环中,我explode()
对每一行使用:explode('::', $result)
. 我如何使用输出这样的数据(例如迭代中的foreach()
前三行):while
Row 1: The first column is 0, the second column is 1, the third column is 123
Row 2: The first column is 1, the second column is 2, the third column is 456
Row 3: The first column is 0, the second column is 3, the third column is 789