Home > Backend Development > PHP Tutorial > How to randomly obtain Kingsoft PowerWord's daily sentence in php

How to randomly obtain Kingsoft PowerWord's daily sentence in php

WBOY
Release: 2016-07-25 08:44:48
Original
1138 people have browsed it

The example in this article describes how to randomly obtain a daily sentence from Kingsoft PowerWord in PHP. Share it with everyone for your reference. The specific implementation method is as follows:

  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. $content=file_get_contents('http://open.iciba.com/dsapi/?date='.$date);
  7. $arr=json_decode($content,true);
  8. print_r($arr);
Copy code

I hope this article will be helpful to everyone’s PHP programming design.

One sentence, Kingsoft PowerWord, php


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template