问题Warning: Invalid argument supplied for foreach() in 完善解决方案
将报错的语句做如下修改(例):
把
QUOTE:
foreach($extcredits as $id => $credit)
{
if($credit[‘ratio’])
{
$exchcredits[$id] = $credit;
}
}
改为
QUOTE:
if(is_array($extcredits)) //add
{
foreach($extcredits as $id => $credit)
{
if($credit[‘ratio’])
{
$exchcredits[$id] = $credit;
}
}
} //add
或
QUOTE:
foreach((array)$extcredits as $id => $credit)
{
if($credit[‘ratio’])
{
$exchcredits[$id] = $credit;
}
}