用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. Bash中的特殊字符

    # 表示注释 #! 指定当前脚本的解析器 #!/bin/bash echo "Hello World" ; 命令分隔符 #!/bin/bash echo hello;echo th ...

  2. React Native 组件之Image

    Image组件类似于iOS中UIImage控件,该组件可以通过多种方式加载图片资源. 使用方式,加载方式有如下几种: /** * Sample React Native App * https://g ...

  3. swift 闭包+嵌套函数+extension+单例+嵌套函数+??

    //: Playground - noun: a place where people can play import UIKit //*******************嵌套函数********* ...

  4. mac下U盘装机系统的制作(命令行)

    1,不插入U盘和插入U盘分别命令检测硬盘,确定要制作的U盘号:diskutil list 2,卸载usb盘,不推出,diskutil umountDisk /dev/disk1 3,将dmg写入U盘, ...

  5. Disable Portrait in app

    I had this problem as well as I wanted to constrain my game to only landscape mode. I put this in my ...

  6. Xcode编译异常和警告汇总(持续更新中)

    1.Method definition for 'xxx' not found xxx的方法没有实现 出现原因.h声明了xxx方法但是.m没有实现xxx方法 解决方法:在类的.m文件实现xxx方法   ...

  7. OpenCV图像Surf与flann特征点(转载)

    Surf(Speed Up Robust Feature) Surf算法的原理                                                             ...

  8. Educational Codeforces Round 15 D 数学推公式

    D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standa ...

  9. ZOJ 1205 Martian Addition

    原题链接 题目大意:大数,20进制的加法计算. 解法:convert函数把字符串转换成数组,add函数把两个大数相加. 参考代码: #include<stdio.h> #include&l ...

  10. 使用 rqt_console 和 roslaunch---8

    使用 rqt_console 和 roslaunch Description: 本教程介绍如何使用rqt_console和rqt_logger_level进行调试,以及如何使用roslaunch同时运 ...