Warning: Invalid argument supplied for foreach() in怎么解决

Warning: Invalid argument supplied for foreach() in怎么解决

出现“Warning: Invalid argument supplied for foreach() in ”问题的解决如下:

QUOTE:
foreach($sxh as $key => $value)
{
这里是内容
}

改为:
QUOTE:
if(is_array($sxh)) //add
{
foreach($sxh as $key => $value)
{
这里是内容
}
} //add


QUOTE:
foreach((array)$sxh as $key => $value)
{
这里是内容
}