php随机获取金山词霸每日一句

 1 header('Content-Type:text/html; charset=utf-8');
 2 $nowyear=date("Y");
 3 $nowmouth = date('m');
 4 $nowday = date('d');
 5 $date = mt_rand("2012",$nowyear)."-".mt_rand("1",$nowmouth)."-".mt_rand("1",$nowday);
 6 
 7 $content=file_get_contents('http://open.iciba.com/dsapi/?date='.$date);
 8 $arr=json_decode($content,true);
 9 echo "<pre>";
10 print_r($arr);

 

posted @ 2015-12-17 11:21  inc  阅读(285)  评论(0编辑  收藏  举报