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运行出现Notice : Use of undefined constant 的完美解决方案分享

Notice: Use of undefined constant ALL_PS - assumed 'ALL_PS' in E:\Server\vhosts\www.lvtao.net...

PHP扩展编写点滴 技巧收集

红色部分是我的注释。 更多信息参看: 1.常用的通用功能已经封装好了,在如zen_API.h 头文件中,不用费力查看内部细节,浪费时间。(参考:Extending and Embeddi...

PHP MVC框架中类的自动加载机制实例分析

PHP MVC框架中类的自动加载机制实例分析

本文实例讲述了PHP MVC框架中类的自动加载机制。分享给大家供大家参考,具体如下: 原文 实现类的自动加载主要使用到了set_include_path和spl_autoload_re...

删除无限分类并同时删除它下面的所有子分类的方法

复制代码 代码如下: $act = isset ($_GET['act']) ? trim ($_GET['act']) : "; if ($act == 'del') { $sort_...

PHP array 的加法操作代码

The + operator appends elements of remaining keys from the right handed array to the left han...