這篇文章給大家分享的是有關(guān)PHP如何實(shí)現(xiàn)新型冠狀病毒疫情實(shí)時(shí)圖的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。
我們擁有10年網(wǎng)頁設(shè)計(jì)和網(wǎng)站建設(shè)經(jīng)驗(yàn),從網(wǎng)站策劃到網(wǎng)站制作,我們的網(wǎng)頁設(shè)計(jì)師為您提供的解決方案。為企業(yè)提供網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站設(shè)計(jì)、微信開發(fā)、小程序設(shè)計(jì)、成都做手機(jī)網(wǎng)站、H5高端網(wǎng)站建設(shè)、等業(yè)務(wù)。無論您有什么樣的網(wǎng)站設(shè)計(jì)或者設(shè)計(jì)方案要求,我們都將富于創(chuàng)造性的提供專業(yè)設(shè)計(jì)服務(wù)并滿足您的需求。我們先來看一下運(yùn)行圖
下面我們來看源代碼:
<?php //抓取抖音的接口數(shù)據(jù) global $nCov_data; $nCov_data['data']=get_nCoV_douyin_news(); $nCov_data['total']=get_nCoV_douyin_total(); function get_nCoV_douyin_news(){ $content=@file_get_contents('https://i.snssdk.com/api/feed/forum_flow/v1/?forum_id=1656388947394568&is_web_refresh=1&channel=local_test&query_id=1656388947394568&tab_id=1656388947394584&is_preview=1&stream_api_version=82&aid=13&forum_id=1656388947394568&is_preview=0'); $c=count(json_decode($content)->data)-1; $getInfos=@json_decode(json_decode($content)->data[$c]->content)->sub_raw_datas; if ($getInfos){ foreach ($getInfos as $k=>$Info){ $data[$k]=[ 'showtime'=>$Info->raw_data->showtime_string,//展示時(shí)間 'desc'=>$Info->raw_data->desc,//簡訊 'event_time'=>$Info->raw_data->event_time//真實(shí)播報(bào)時(shí)間 ]; } return $data; }else{ return false; } } function get_nCoV_douyin_total(){ $content=@file_get_contents('https://i.snssdk.com/forum/home/v1/info/?forum_id=1656388947394568&is_web_refresh=1'); $getInfos=@json_decode(json_decode($content)->forum->extra->ncov_string_list); $data['desc']=@json_decode($content)->forum->rich_content; $data['img']=@json_decode($content)->forum->extra->ncov_image_url; if ($getInfos){ foreach ($getInfos as $k=>$Info){ $data['provinces'][$k]=$Info; } return $data; }else{ return false; } } ?> <!doctype html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta author="__Mark_Cheng__QQ72817"> <link rel="stylesheet" href="CSS/index.css" rel="external nofollow" > <title>實(shí)時(shí)更新:新型冠狀病毒肺炎疫情</title> </head> <body> <div class="view"> <div class="header"> <div class="title">新型冠狀病毒肺炎</div> <div class="to-title">疫情通報(bào)</div> </div> <div class="show"> <div class="total"> <p class="title"><span>實(shí)時(shí)疫情狀況</span><span>數(shù)據(jù)抓取時(shí)間:<?php echo date('Y.m.d H:i');?></span></p> <p class="desc"><?php echo $nCov_data['total']['desc'];?></p> </div> <div class="map"> <img src="<?php echo $nCov_data['total']['img'];?>" alt="實(shí)時(shí)地圖" width="100%"> </div> <div class="list"> <ul> <?php foreach ($nCov_data['total']['provinces'] as $key=>$val){ echo '<li><span>'.$val.'</span></li>'; } ?> </ul> </div> <div class="timeline"> <div class="title">疫情追蹤</div> <div class="c"> <?php foreach ($nCov_data['data'] as $key=>$val){ ?> <div class="content"> <div class="i"></div> <div class="c"> <div class="show_time"> <?php echo date('m月d日 H:i',$val['event_time']);?> </div> <div class="desc"> <?php echo $val['desc'];?> </div> </div> </div> <?php } ?> </div> </div> <div class="tip"> <img src="https://mat1.gtimg.com/news/images/inews/2020/feiyan/18/img/prevent.png" alt="溫馨提示" width="100%"> </div> </div> </div> </body> </html>
分析:其中PHP代碼中的圖片路徑可以自己保存到本地進(jìn)行修改。
感謝各位的閱讀!關(guān)于“PHP如何實(shí)現(xiàn)新型冠狀病毒疫情實(shí)時(shí)圖”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
本文標(biāo)題:PHP如何實(shí)現(xiàn)新型冠狀病毒疫情實(shí)時(shí)圖-創(chuàng)新互聯(lián)
鏈接地址:http://muchs.cn/article46/dpdshg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、網(wǎng)站維護(hù)、網(wǎng)站制作、虛擬主機(jī)、品牌網(wǎng)站制作、網(wǎng)站營銷
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容