|
本帖最后由 EScZkc_1d8 于 2021-4-13 09:00 编辑
这个你随便找个在线测试php代码的放进去运行一下看看就知道了。programes[0]里的0可以改为1 2 3 4 ……自己看看效果。
- <?php
- $info = 'video({"channel":{"id":"242","programes":[{"id":"1437450","name":"正义中国","startTime":"05:55","endTime":"06:20","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/202104120555001500.m3u8"},{"id":"1437452","name":"重播《联播城区-走进开平》","startTime":"06:30","endTime":"06:43","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/20210412063000780.m3u8"},{"id":"1438184","name":"唐山新闻重新录制","startTime":"06:31","endTime":"07:00","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/202104120631081748.m3u8"},{"id":"1437457","name":"重播《直播50分》","startTime":"07:00","endTime":"07:50","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/202104120700003000.m3u8"},{"id":"1437458","name":"重播《法治视窗》","startTime":"07:50","endTime":"08:10","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/202104120750001200.m3u8"},{"id":"1437459","name":"家庭剧场(三集连播)","startTime":"08:10","endTime":"11:56","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/2021041208100013560.m3u8"},{"id":"1437460","name":"天气预报","startTime":"11:56","endTime":"12:00","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/20210412115600240.m3u8"},{"id":"1437461","name":"正义中国","startTime":"12:00","endTime":"14:30","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/202104121200009000.m3u8"},{"id":"1437462","name":"家庭剧场(四集连播)","startTime":"14:30","endTime":"17:35","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/2021041214300011100.m3u8"},{"id":"1437465","name":"电影人生","startTime":"17:35","endTime":"18:00","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/202104121735001500.m3u8"},{"id":"1437467","name":"直播50分","startTime":"18:00","endTime":"18:50","canReplay":"1","type":"vod","M3U8":"http://live1.tsr.he.cn:1936/live/tstv1/1000k/202104121800003000.m3u8"},{"id":"1437468","name":"联播城区-路北新视野","startTime":"18:50","endTime":"19:00","canReplay":"1","type":"live","M3U8": ""},{"id":"1437470","name":"转播《中样台新闻联播》","startTime":"19:00","endTime":"19:30","canReplay":"1","type":"unstart","M3U8": ""},{"id":"1437471","name":"唐山新闻","startTime":"19:33","endTime":"19:50","canReplay":"1","type":"unstart","M3U8": ""},{"id":"1437472","name":"联播城区-聚焦曹妃甸","startTime":"19:50","endTime":"20:04","canReplay":"1","type":"unstart","M3U8": ""},{"id":"1437477","name":"天气预报","startTime":"20:04","endTime":"20:10","canReplay":"1","type":"unstart","M3U8": ""},{"id":"1437484","name":"热播剧场(两集连播)","startTime":"20:23","endTime":"22:00","canReplay":"1","type":"unstart","M3U8": ""},{"id":"1437485","name":"重播《唐山新闻》","startTime":"22:00","endTime":"22:20","canReplay":"1","type":"unstart","M3U8": ""},{"id":"1437486","name":"重播《直播50分》","startTime":"22:20","endTime":"23:10","canReplay":"1","type":"unstart","M3U8": ""},{"id":"1437493","name":"电影藏密","startTime":"23:52","endTime":"00:17","canReplay":"1","type":"unstart","M3U8": ""}]}} )
- ';
- $info = substr($info,6,strlen($info)-10);
- $json=json_decode($info);
- echo $json->channel->programes[0]->id;
- echo $json->channel->programes[0]->name;
- ?>
复制代码 |
|