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

yipeiwu_com6年前PHP代码库

本文实例讲述了php随机获取金山词霸每日一句的方法。分享给大家供大家参考。具体实现方法如下:

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);

希望本文所述对大家的php程序设计有所帮助。

相关文章

PHP 日常开发小技巧

PHP批最取得checkbox的值 1、命名 <input type='checkbox' name='checkbox[]' value=$dwmyrow[banzhu] /&g...

php下通过IP获取地理位置的代码(小偷程序)

复制代码 代码如下: function get_ip_place() { $ip=file_get_contents("http://fw.qq.com/ipaddress"); $ip...

php Smarty 字符比较代码

eq相等, ne、neq不相等, gt大于, lt小于, gte、ge大于等于, lte、le 小于等于, not非, mod求模。 is [not] div by是否能被某数整除, i...

PHP产生随机字符串函数

<?php  /**   * 产生随机字符串   *   * 产生一个指定长度的随机字符串...

php使用curl获取header检测开启GZip压缩的方法

本文实例讲述了php使用curl获取header检测开启GZip压缩的方法。分享给大家供大家参考,具体如下: 获得网页header信息,是网站开发人员和维护人员常用的技术。网页的head...