在PHP中,可以使用json_decode函数将JSON字符串转换为PHP数组,然后通过数组索引访问到第一个/'ext/'的值。//n//n以下是获取到第一个/'ext/'的示例代码://n//nphp//n/$json = '{//n /'sites/': [//n {//n /'key/': /'csp_appys_影探/',//n /'name/': /'❤影探主接口|4K/',//n /'type/': 3,//n /'api/': /'csp_AppYsV2/',//n /'searchable/': 1,//n /'quickSearch/': 1,//n /'filterable/': 1,//n /'ext/': /'http://yt22106.lfytyl.com/api.php/app//'//n },//n {//n /'key/': /'csp_WoGG/',//n /'name/': /'玩偶影视┃4K/',//n /'type/': 3,//n /'api/': /'csp_WoGG/',//n /'searchable/': 1,//n /'quickSearch/': 1,//n /'filterable/': 1,//n /'ext/': /'http://127.0.0.1:9978/file/tvfan/token.txt+4k|fhd|auto$$$http://tvfan.xxooo.cf//'//n },//n {//n /'key/': /'农民影视/',//n /'name/': /'✈️速度流畅/',//n /'type/': 3,//n /'api/': /'csp_Nmys/',//n /'searchable/': 1,//n /'quickSearch/': 1,//n /'filterable/': 1,//n /'ext/': /'http://饭太硬.top/x/json/nmys.json/'//n }//n ]//n}';//n//n/$data = json_decode(/$json, true);//n/$ext = /$data['sites'][0]['ext'];//n//necho /$ext; // 输出第一个/'ext/'的值//n//n//n上述代码中,首先通过json_decode函数将JSON字符串转换为PHP数组。然后,使用数组索引['sites'][0]['ext']访问到第一个/'ext/'的值。最后,通过echo语句输出该值。

PHP获取JSON数据中第一个ext的值 - 代码示例

原文地址: https://www.cveoy.top/t/topic/p1LW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录