Nested foreach, first traverse the corresponding detail list under the corresponding document based on the document id (billId), such as $v2='00001' and '00002', and then based on the obtained detailed data (for example, there are 50 records under 00001 , there are 60 records under 00002), the table is output, but the result is always 60 records under 00002. How to splice the results of the two traversals together?
foreach ($danju as $k2 => $v2){
$url_mingxi="http://xxxx.xxxx.com/purOrder/getOrderDetailInfo.action?billId=$v2";
$arr_mingxi=curl_get($url_mingxi,$cookie_jar,$UserAgent);
foreach($arr_mingxi as $keys => $values){
$html .= "<tr><td>{$arr_mingxi[$keys]['spbmhx']}</td><td>{$arr_mingxi[$keys]['pluCode']}</td><td>{$arr_mingxi[$keys]['pluName']}</td></tr>";
}
}
echo $html;
Merge in inner loop. Specifically, it means overlapping and merging
It is recommended that you encapsulate the inner code and then output it. Please refer to the code below