将需要被遍历的数组强制转换为数组类型即可

<?php
$array = null;
foreach((array)$array as $value){
#..code....
}
?>

Invalid argument supplied for foreach()的更多相关文章

  1. php foreach 语法的遍历来源数组如果不是一个有效数组php会出现错误警告 Invalid argument supplied for foreach()

    在php中,foreach语法的遍历来源数组如果不是一个有效数组,php会出现错误警告 Invalid argument supplied for foreach() ,但是很多时候这个数组是取自某些 ...

  2. Yii 提示Invalid argument supplied for foreach() 等错误

    Yii 提示Invalid argument supplied for foreach() 或者 undefined variable: val等错误 只需要在对应的文件中加入error_report ...

  3. PHP--Warning: Invalid argument supplied for foreach() in ...

    1.背景 今天学习PHPExcel的使用,在代码执行foreach($data as $value){...}的时候出现这样一个警告提示:Warning: Invalid argument suppl ...

  4. foreach的参数不是数组:Warning: Invalid argument supplied for foreach

    Warning: Invalid argument supplied for foreach() 问题Warning: Invalid argument supplied for foreach() ...

  5. Warning: Invalid argument supplied for foreach()

    经常对提交过来的数据进行双重循环,但是为空时会报错:Warning: Invalid argument supplied for foreach() 如下解决即可:foreach($data[$i]  ...

  6. NOTIC: Invalid argument supplied for foreach()

    NOTIC: [2] Invalid argument supplied for foreach() Warning: Invalid argument supplied for foreach() ...

  7. PHP:Invalid argument supplied for foreach()错误原因及解决办法

    在php中使用foreach循环遍历时报Invalid argument supplied for foreach()错误,是因为循环的数据不是一个有效的数组. 因此我们只要在foreach之前判断一 ...

  8. file_put_contents 错误:failed to open stream: Invalid argument 一种原因

    今天在测试nilcms系统的时候,出现了一个报错,导致缓存无法更新: file_put_contents(C:\UPUPW_AP5.4\vhosts\d.tv\NilCMS_APP\include_r ...

  9. fdisk添加分区引起的Linux Error: 22: Invalid argument

    在Linux服务器(虚拟机)上使用fdisk添加分区.格式化分区后,遇到了Linux Error: 22: Invalid argument错误,操作步骤如下所示 [root@oracle-serve ...

随机推荐

  1. html 动态添加TABLE的行。

    <script type="text/javascript"> var pos =4;//默认位置为4,根据自己需要,也可以通过鼠标事件获取当前行数. function ...

  2. python(3)-集合

    集合就是把不同的元素组织在一起,但在集合中不允许有重复的元素. >>> a = set() #创建集合 >>> type(a) <class 'set'> ...

  3. [改善Java代码]若有必要,使用变长数组

    Java中的数组是定长的,一旦经过初始化声明就不可改变长度,这在实际使用的时候非常不方便.比如要对一个班级的学生信息进行统计,因为我们不知道班级会有多少个学生(随时可能有退学,入学,转学),所以需要一 ...

  4. 关于location.href几种用法的区别

    常见的几种开发形式: self.location.href; window.location.href; this.location.href; location.href; parent.locat ...

  5. Cocos2d-x开发实例:使用Lambda 表达式

    在Cocos2d-x 3.0之后提供了对C++11标准[1]的支持,其中的Lambda[2]表达式使用起来非常简洁.我们可以使用Lambda表达式重构上一节的实例. 我们可以将下面的代码: liste ...

  6. iOS开发——根据Url 获取图片尺寸

    转自:http://www.oschina.net/code/snippet_2248391_53038 // 根据图片url获取图片尺寸 +(CGSize)getImageSizeWithURL:( ...

  7. UIProgressView[进度条][一般型];UIStepper步数器][事件驱动型]

    ////  ViewController.m//  ProgressAndSteper////  Created by hehe on 15/9/21.//  Copyright (c) 2015年 ...

  8. Android EditText不弹出输入法焦点问题的总结

    转自:http://mobile.51cto.com/aprogram-403138.htm 看一个manifest中Activity的配置,如果这个页面有EditText,并且我们想要进入这个页面的 ...

  9. jqGrid API 相关

    取消所有选中的行: $("jqgridtableid").trigger("reloadGrid"): 设定选中行,可设定多行选中: $("jqgri ...

  10. info sed 中文不完全文档

    快速指南: sed 的一般使用方法:sed -option 'adress|command' -f scpritfiles(1)'|' 只是用来说明性的分隔 adress 和 command,实际使用 ...