将windows上写的php文件copy到ubuntu,打开时出现错误
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Warning: Unknown: Failed opening '/var/www/test/post_utf8.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
经查找是问题,将文件权限改为755,就OK了
sudo chmod 755 php.php   <-----------------------------文件名
sudo chmod 755 *.php   <--------------------------所有文件
结论:从windows下copy东东到linux,注意权限问题
问题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;
         }
}