Two levels of nested foreach threw an error,
Warning: Invalid argument supplied for foreach()
Invalid argument. I debugged it myself for a long time without solving it. On Baidu I found an answer someone had given: $array =array(); if (is_array($array) && count($array)>0 ){ foreach($array as $val){ } } Add a check for foreach, and the whole problem is solved.

