回顾历史的长河,历史是生活的一面镜子;以史为鉴,可以知兴衰;历史上的每一天,都是喜忧参半;可以了解历史的这一天发生的事件,借古可以鉴今,历史是不能忘记的。 这里你可以阅读每一天的历史故事,每天发生了哪些大事,历史上谁诞生和逝世了,每天都是什么纪念日、节日,在这里你都可以容易浏览到!
在我们生活中,日历是一个简单而重要的工具,只要翻开不同年份的日历,你会发现日期的排布总是一样的,在每一年我们都会经历相同的一天,比如元旦或圣诞节,就好像我们每一天出门,总会从门口经过一样。就在这简单的一天里,在历史上曾经发生过许多不同寻常的事情,甚至是改变世界历史的事情。这些历史事件发生的时间和意义被牢牢地记录在历史书籍上,也许你会碰巧发现一些重要的历史事件发生的日期就是你出生的那一天。如果幸运的话,也许你的生日会和某一个重要节日重合,这是多么有趣的事情啊!因此我们编写了这一套以日期为顺序的阅读百科书籍,让读者知道在自己生日那一天,或者是在自己感兴趣的那一天里,在历史上都发生过什么重要的事情,使读者为自己出生的那天而自豪,激励读者为自己的理想而努力奋斗
二、数据源
下列一年三百六十六天(含闰年2月29日)。点击某天,可查阅以往该日历史。
1月12345678910111213141516171819202122232425262728293031 2月1234567891011121314151617181920212223242526272829 3月12345678910111213141516171819202122232425262728293031
4月123456789101112131415161718192021222324252627282930 5月12345678910111213141516171819202122232425262728293031 6月123456789101112131415161718192021222324252627282930
7月12345678910111213141516171819202122232425262728293031 8月12345678910111213141516171819202122232425262728293031 9月123456789101112131415161718192021222324252627282930
10月12345678910111213141516171819202122232425262728293031 11月123456789101112131415161718192021222324252627282930 12月12345678910111213141516171819202122232425262728293031
三、预览
实现代码:
<?php define("token", "weixin"); $wechatobj = new wechatcallbackapitest(); if (!isset($_get['echostr'])) { $wechatobj->responsemsg(); }else{ $wechatobj->valid(); } class wechatcallbackapitest { public function valid() { $echostr = $_get[echostr]; if($this->checksignature()){ echo $echostr; exit; } } private function checksignature() { $signature = $_get[signature]; $timestamp = $_get[timestamp]; $nonce = $_get[nonce]; $token = token; $tmparr = array($token, $timestamp, $nonce); sort($tmparr); $tmpstr = implode($tmparr); $tmpstr = sha1($tmpstr); if($tmpstr == $signature){ return true; }else{ return false; } } public function responsemsg() { $poststr = $globals[http_raw_post_data]; if (!empty($poststr)){ $postobj = simplexml_load_string($poststr, 'simplexmlelement', libxml_nocdata); $rx_type = trim($postobj->msgtype); switch ($rx_type) { case text: $resultstr = $this->receivetext($postobj); break; case event: $resultstr = $this->receiveevent($postobj); break; default: $resultstr = ; break; } echo $resultstr; }else { echo ; exit; } } private function receivetext($object) { $keyword = trim($object->content); $url = http://api100.duapp.com/history/?appkey=trialuser; $output = file_get_contents($url); $contentstr = json_decode($output, true); if (is_array($contentstr)){ $resultstr = $this->transmitnews($object, $contentstr); }else{ $resultstr = $this->transmittext($object, $contentstr); } return $resultstr; } private function receiveevent($object) { $contentstr = ; switch ($object->event) { case subscribe: $contentstr = 欢迎关注方倍工作室; break; default: break; } $resultstr = $this->transmittext($object, $contentstr); return $resultstr; } private function transmittext($object, $content) { $texttpl = <xml> <tousername><![cdata[%s]]></tousername> <fromusername><![cdata[%s]]></fromusername> <createtime>%s</createtime> <msgtype><![cdata[text]]></msgtype> <content><![cdata[%s]]></content> </xml>; $resultstr = sprintf($texttpl, $object->fromusername, $object->tousername, time(), $content); return $resultstr; } private function transmitnews($object, $arr_item) { if(!is_array($arr_item)) return; $itemtpl = <item> <title><![cdata[%s]]></title> <description><![cdata[%s]]></description> <picurl><![cdata[%s]]></picurl> <url><![cdata[%s]]></url> </item> ; $item_str = ; foreach ($arr_item as $item) $item_str .= sprintf($itemtpl, $item['title'], $item['description'], $item['picurl'], $item['url']); $newstpl = <xml> <tousername><![cdata[%s]]></tousername> <fromusername><![cdata[%s]]></fromusername> <createtime>%s</createtime> <msgtype><![cdata[news]]></msgtype> <content><![cdata[]]></content> <articlecount>%s</articlecount> <articles> $item_str</articles> </xml>; $resultstr = sprintf($newstpl, $object->fromusername, $object->tousername, time(), count($arr_item)); return $resultstr; } } ?>
更多微信公众平台开发历史上的今天 。
