PHP stdclass转array的方法
2016-11-25 11:13
369 查看
PHP stdclass转array的方法
<?php $a = new stdClass(); $a->id = '11 '; $a->username = 'me'; print_r($a); $b=object2array($a); print_r($b); function object2array($object) { $object1 = json_decode( json_encode( $object),true); return $object1; } ?>
输出结果
stdClass Object ( [id] => 11 [username] => me ) Array ( [id] => 11 [username] => me )
查看原文:http://newmiracle.cn/?p=486
相关文章推荐
- php “Cannot use object of type stdClass as array” 的解决方法
- PHP JSON出错:Cannot use object of type stdClass as array解决方法
- PHP中stdClass简介及 stdClass Object转array方法
- PHP JSON出错:Cannot use object of type stdClass as array解决方法
- php错误 Fatal error: Cannot use object of type stdClass as array in……
- php中把stdClass Object转array的几个方法
- PHP中把stdClass Object转array的几个方法
- PHP“Cannot use object of type stdClass as array”
- PHP中把stdClass Object转array的几个方法
- Php中StdClass、object、array的概念
- php数组转换为对象PHP - Convert Array to Object with stdClass
- PHP中把stdClass Object转array(对象转数组)的几个方法
- php new stdClass array 实例代码
- PHP“Cannot use object of type stdClass as array”
- PHP“Cannot use object of type stdClass as array”
- PHP中把stdClass Object转array的几个方法
- PHP“Cannot use object of type stdClass as array”
- **PHP错误Cannot use object of type stdClass as array in错误的
- PHP“Cannot use object of type stdClass as array”
- PHP使用new StdClass()创建空对象的方法分析