Home >Backend Development >PHP Tutorial >PHP method to randomly obtain Kingsoft PowerWord's daily sentence, Kingsoft PowerWord's daily sentence_PHP tutorial
This article describes the method of randomly obtaining a daily sentence from Kingsoft PowerWord in php. Share it with everyone for your reference. The specific implementation method is as follows:
header('Content-Type:text/html; charset=utf-8'); $nowyear=date("Y"); $nowmouth = date('m'); $nowday = date('d'); $date = mt_rand("2012",$nowyear)."-".mt_rand("1",$nowmouth)."-".mt_rand("1",$nowday); $content=file_get_contents('http://open.iciba.com/dsapi/?date='.$date); $arr=json_decode($content,true); print_r($arr);
I hope this article will be helpful to everyone’s PHP programming design.