PHP中把对象转换为关联数组代码分享
/** * 对象转关联数组 * @author * @param object $obj * @return array */ function object_to_array($obj){ $_arr = is_object($obj) ? get_object_vars($obj) : $obj; foreach ($_arr as $key => $val){ $val = (is_array($val) || is_object($val)) ? $this->object_to_array($val) : $val; $arr[$key] = $val; } return $arr; }
相关推荐
微麦PHP 2019-06-28
bcbeer 2014-02-09
likun00 2019-04-16
PETERSHEN 2017-03-15
半粒红豆 2010-12-15
rootmiss 2009-11-17
txlCandy 2019-04-25
Pythonandme 2015-05-04
weixuejunphp 2017-10-18
phpsir 2017-04-04
付海军 2019-04-16
明天你好 2012-05-24
雷潇 2010-05-19
thickbookszone 2019-02-18
FaithX 2010-07-19
xuekai0 2010-07-19
愤怒的小狐狸 2010-07-16
USTBHacker 2010-07-16