当前位置:网站首页>学习使用php把stdClass Object转array的方法整理
学习使用php把stdClass Object转array的方法整理
2022-08-04 09:19:00 【徊忆羽菲】
学习使用php把stdClass Object转array的方法整理
对象转数组方法
function object2array_pre(&$object) {
if (is_object($object)) {
$arr = (array)($object);
} else {
$arr = &$object;
}
if (is_array($arr)) {
foreach($arr as $varName => $varValue){
$arr[$varName] = $this->object2array($varValue);
}
}
return $arr;
}
function object2array(&$object) {
$object = json_decode( json_encode( $object),true);
return $object;
}
以上两个方法结合使用
边栏推荐
- Quick tips for getting out of a single
- 【正点原子STM32连载】第二章 STM32简介 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1
- No module named 'flask_misaka' has been resolved [BUG solution]
- TiCDC同步延迟问题处理
- 蜜芽CEO刘楠:垂直电商黄金时代已落幕 坚定转型品牌之路
- 将jpg图片转换成yuv420(NV12)数据文件
- tcp连接的细节
- 【云驻共创】HCSD 大咖直播–就业指南
- IDEA 自动导入的配置(Auto import)
- leetcode动态规划系列(求路径篇)
猜你喜欢
![[Punctuality Atomic STM32 Serial] Chapter 1 Learning Method of the Book Excerpted from [Punctuality Atomic] MiniPro STM32H750 Development Guide_V1.1](/img/99/23e3dcb426769a415e33f7ff51bbb8.png)
[Punctuality Atomic STM32 Serial] Chapter 1 Learning Method of the Book Excerpted from [Punctuality Atomic] MiniPro STM32H750 Development Guide_V1.1

命里有时终须有--记与TiDB的一次次擦肩而过

外包干了四年,秋招终于上岸了

cannot import name ‘import_string‘ from ‘werkzeug‘【bug解决】

leetcode单调栈经典例题——最大矩形

Grafana9.0发布,Prometheus和Loki查询生成器、全新导航、热图面板等新功能!

请你谈谈网站是如何进行访问的?【web领域面试题】

他97年的,我既然卷不过他...

有坦荡的远方
![Detailed Explanation of Addresses Delivered by DHCP on Routing/Layer 3 Switches [Huawei eNSP]](/img/9c/b4ebe608cf639b8348adc1f1cc71c8.png)
Detailed Explanation of Addresses Delivered by DHCP on Routing/Layer 3 Switches [Huawei eNSP]
随机推荐
Interview at 14:00 in the afternoon, I came out at 14:08 with my head down, asking too much...
请问下Flink SQL如何写hologres分区表?我想要每天一个分区
将jpg图片转换成yuv420(NV12)数据文件
用OpenGL绘制winXP版扫雷的笑脸表情
MindSpore:【mindinsight】【Profiler】用execution_time推导出来的训练耗时远小于真实的耗时
【C补充】指针相关知识点收集01
oracle sql multi-table query
[Punctuality Atomic STM32 Serial] Chapter 1 Learning Method of the Book Excerpted from [Punctuality Atomic] MiniPro STM32H750 Development Guide_V1.1
【正点原子STM32连载】第一章 本书学习方法 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1
VRRP+MSTP配置详解【华为eNSP实验】
Cloud function to achieve automatic website check-in configuration details [Web function/Nodejs/cookie]
VRRP + MSTP configuration, huawei eNSP experiment 】 【
2022年制冷与空调设备运行操作特种作业证考试题库及模拟考试
Detailed explanation of telnet remote login aaa mode [Huawei eNSP]
TiCDC同步延迟问题处理
async - await
SQL后计算的利器
Since his 97, I roll but he...
ISO14443A读卡流程(作为示例参考)
已解决No module named ‘flask_misaka‘【BUG解决】