php数组字符串处理求助
我现有的json数据是:[{"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格式数据:
[
{"d1":
[
{
"name":"百度网盘",
"url":"https:\/\/11111",
"tqm":"提取码:qwer",
"jym":"解压码:1234",
}
]
},
{"d2":
[
{
"name":"百度网盘",
"url":"https:\/\/11111",
"tqm":"提取码:qwer",
"jym":"解压码:1234",
}
]
}
]
目前我使用的是explode进行处理,但是这个用在tp6需要修改,所以路过的大佬帮忙看下
$str="百度网盘 | https://pan.baidu/xxxx | 提取码:qwer |解压码:1234";
$str=str_replace(' ','',$str);
$arr=explode("|", $str,5);
return json($arr); explode能处理那就用他啊{:1_926:} 有大佬吗
页:
[1]