我试图列出所有逗号分隔的值。
<?php
$records = [
["WLP001","Cream Ale,Dusseldorf Altbier,Kolsch,Ordinary Bitter"],
["WLP002","American Amber,American Brown Ale,American India Pale Ale,American Pale Ale,American Porter,Apple Wine,Barleywine Ale,Common Perry,Cream Ale,Dusseldorf Altbier,English Brown Ale,English Cider,English India Pale Ale,English Old Ale,English Pale Ale,Extra Special Bitter,Foreign Export Stout,French Cider,Irish Dry Stout,Irish Red Ale,Kolsch,Oatmeal Stout,Ordinary Bitter,Scotch Ale (Wee Heavy),Sweet Stout,Wheat Ale"],
];
for ($i=0; $i < count($records); $i++) {
$styles = explode(',',$records[$i][1]);
echo $styles[0]."<br>";
}
?>
例如
对于“WLP001” 和“WLP002”
Cream Ale,
Dusseldorf Altbier,
Kolsch,
Ordinary Bitter,
American Amber,
American Brown Ale,
American India Pale Ale,
只要数据以逗号分隔,它就会继续其余部分。
因为现在的输出是
翻翻过去那场雪