当前位置:网站首页>PHP解析json数据,显示
PHP解析json数据,显示
2022-08-08 19:11:00 【producing】
1、比如我们有像这样一个基层结构的json数据,表面看条件只有三层,后面也是只需要判断这三层并同时循环生成即可。
{"all":[
{"books":
{
"id": 110,
"sec": 1,
"year": 1944,
"pic": "kakaxi.jpg",
"content": "kakajkakhjsb1bdbhbakbdkadad",
"findword": "main keyword",
"author": [
"author-name1",
"author-name2"
],
"key":[
"keyword1",
"keyword2"
]
}}]}2、上代码(部分)
(1)解析数据获取适合php操作的数据
$url = 'https://haha';
$json_string = file_get_contents($url);2、开始找数据
$i=0;
// 循环查找内容
function foreachFun($d,$word){
foreach ($d["all"] as $key => $value) {
$allresult = $value;
}
$sortrev='rev&边栏推荐
猜你喜欢
随机推荐
Fortinet new cloud native protection products launched amazon cloud platform of science and technology
堆排序实现代码
黑猫带你学Makefile第8篇:uboot/kernel中的makefile基本语法与流程
The history of cartoon rendering
Codeforces Round #713 (Div. 3) E(思维)
文档管理系统对于企业来说有哪些作用?
MogDB study notes - starting from 0
Word清除格式在哪里?Word清除格式使用方法
PyTorch入门:(三)Transforms的使用
室外光纤资源管理——可视化管理平台
Codeforces Round #712 (Div. 2)(CD)
view, index
【kali-权限提升】(4.2.6)社会工程学工具包(上):中间人攻击原理
n个数取出r个数排列
hdu2018 母牛的故事(模拟)
Why Manufacturing Companies Should Deploy Digital Factory Systems
Redhat 7 Maria DB installation and configuration
Azure Neural TTS continues to be updated to help enterprises develop small language markets
Why do programmers only close monitor from none computer after work?Look at the answer ~ each big web site
uniapp parent component uses prop to pass asynchronous data to child components




![[MRCTF2020]你传你码呢](/img/5b/28eede6532decad6c57db62d30bf9c.png)




