用json传过来的数组并不是标准的array,所以需要用这个函数进行转换。

function object_array($array)
{
   if(is_object($array))
   {
    $array = (array)$array;
   }
   if(is_array($array))
   {
    foreach($array as $key=>$value)
    {
     $array[$key] = object_array($value);
    }
   }
   return $array;
}

PHP stdClass Object转array的更多相关文章

  1. PHP------数组和对象相互转化,stdClass Object转array

    数组转JSON PHP json_encode() 用于对变量进行 JSON 编码,该函数如果执行成功返回 JSON 数据,否则返回 FALSE . JSON转数组 PHP json_decode() ...

  2. PHP中把stdClass Object转array的几个方法

    方法一: 复制代码代码如下: //PHP stdClass Object转array function object_array($array) { if(is_object($array)) { $ ...

  3. php--->把json传来的stdClass Object类型转array

    php把json传来的stdClass Object类型转array 1.Php中stdClass.object.array的概念 stdClass是PHP的一个基类,即一个空白的类,所有的类几乎都继 ...

  4. php如何遍历多维的stdClass Object 对象,php的转换成数组的函数只能转换外面一丛数组

    php如何遍历多维的stdClass Object 对象,php的转换成数组的函数只能转换外面一丛数组 (2012-09-10 19:58:49) 标签: 杂谈 分类: 网页基础知识 php如何遍历多 ...

  5. php stdClass Object 问题

    Array ( [0] => stdClass Object ( [term_id] => 3 [name] => apache [slug] => apache [term_ ...

  6. PHP中遍历stdclass object 及 json 总结[中国航天神舟十号以json形式向地面返回数据]

    $test=Array ( [0] => stdClass Object ( [tags] => 最快的车,Bloodhound,SSC [id] => 48326888 11 从网 ...

  7. PHP中遍历stdclass object 及 json

    原文:PHP中遍历stdclass object 及 json (从网上找的模拟实例)需要操作的数据: $test=Array ( [0] => stdClass Object ( [tags] ...

  8. 数组中的stdClass Object如何访问

    使用print_r($data)输出结果为 Array ( [0] => stdClass Object ( [color_item_no] => 1 [color_name] => ...

  9. php json 解析有stdClass Object 解决办法

    php json 解析有stdClass Object mixed json_decode ( string $json [, bool $assoc = false [, int $depth = ...

随机推荐

  1. ubuntu系统安装mongodb

    安装mongodb sudo apt-get install mongodb ... ... 设置客户端连接 打开文件/etc/mongodb.conf  注意权限 修改 bind_ip=127.0. ...

  2. swift系统学习控件篇:UIbutton+UIlabel+UITextField+UISwitch+UISlider

    工作之余,学习下swift大法.把自己的学习过程分享一下.当中的布局很乱,就表在意这些细节了.直接上代码: UIButton+UILabel // // ViewController.swift // ...

  3. IE6-8支持css3属性

    方法一.让IE6-8支持css3属性 <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shi ...

  4. C#指针操作Marshal实例

    static void Main(string[] args) { ,,,}; ,,,}; IntPtr pt = Marshal.AllocHGlobal(a.Length); //从source数 ...

  5. 【转】Paxos算法深入分析

    http://blog.csdn.net/anderscloud/article/details/7175209 在分布式系统设计领域,Paxos可谓是最重要一致性的算法.Google的大牛们称   ...

  6. C#山寨版本【天翼拨号客户端】---内含详细抓包,模拟数据---万事俱备,只欠东风。

    官方的客户端的最大缺点: 1.一台电脑不允许使用同时启动多个网卡(目的是禁止使用虚拟WIFI或通过网卡后共享网络到路由器?): 2.使用路由器无法拨号(提示:不允许NAT后登录) 3.之前用某哥们破解 ...

  7. invoke Javascript from C# code

    http://justyouraveragegeek.com/blog/index.php/2010/03/winforms-with-a-webbrowsercontrol-fun-with-obj ...

  8. LeetCode Minimum Path Sum (简单DP)

    题意: 给一个n*m的矩阵,每次可以往下或右走,经过的格子中的数字之和就是答案了,答案最小为多少? 思路: 比较水,只是各种空间利用率而已. 如果可以在原空间上作修改. class Solution ...

  9. 兼容性所有浏览器的透明CSS设置

    兼容所有浏览器的透明CSS设置: .transparent_class { filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0. ...

  10. vcf_filter.py

    pyvcf 中带的一个工具 比其他工具用着好些 其他filter我很信不过~~  自己写的功能又很有限 所以转投vcf_filter.py啦 Filtering a VCF file based on ...