我现有的json数据是:
[PHP] 纯文本查看 复制代码 [{"d1":"百度网盘 | https:\/\/11111 | 提取码:qwer |解压码:1234","d2":"百度网盘 |2222xx | 提取码:qwer |解压码:1234","d3":"百度网盘 | https:\/\/pan.baidu\/xxxx | 提取码:qwer |解压码:1234"},{"d1":"百度网盘 | 2222111 | 提取码:qwer |解压码:1234","d2":"百度网盘 | 22222222 | 提取码:qwer |解压码:1234","d3":"百度网盘 | https:\/\/pa22233333 | 提取码:qwer |解压码:1234"}]
这个是我想要的json格式数据:
[Asm] 纯文本查看 复制代码 [
{"d1":
[
{
"name":"百度网盘",
"url":"https:\/\/11111",
"tqm":"提取码:qwer",
"jym":"解压码:1234",
}
]
},
{"d2":
[
{
"name":"百度网盘",
"url":"https:\/\/11111",
"tqm":"提取码:qwer",
"jym":"解压码:1234",
}
]
}
]
目前我使用的是explode进行处理,但是这个用在tp6需要修改,所以路过的大佬帮忙看下
[Asm] 纯文本查看 复制代码 $str="百度网盘 | https://pan.baidu/xxxx | 提取码:qwer |解压码:1234";
$str=str_replace(' ','',$str);
$arr=explode("|", $str,5);
return json($arr); |