摘要: API获取天气预报,以及使用飞信API,给好友发送短信 加上计划任务,就可以持续每天自动发送天气预报给自己和亲人啦。。。 <?php ########## # jiam 2012/12/5 # 1113160783@qq.com #自动发送飞信 #中间涉及到飞信接口 #天气预报API #以及城市代码 ########## #101180101是郑州城市代码 #101180301是新乡城市代码 $url='http://m.weather.com.cn/data/101180101.html'; $xinxiang='http://m.weather.com.cn/ 阅读全文
posted @ 2013-02-03 14:30 幻星宇 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 这个抽奖小程序,在实际的测试环境中也可以用到,比方说测试数据的查询在in条件下,要查询随机的5个id,然后在用ab去压测[代码][PHP]代码view sourceprint?01<?php02/**03* “抽奖”函数04*05* @param integer $first 起始编号06* @param integer $last 结束编号07* @param integer $total 获奖人数08*09* @return string10*11*/12functionisWinner($first,$last,$total)13{14$winner=array();15for($ 阅读全文
posted @ 2013-02-03 14:19 幻星宇 阅读(273) 评论(0) 推荐(1) 编辑
摘要: [代码][PHP]代码view sourceprint?01<?php02/**03* @author phpman.cn04* @date 2012/12/0405* @todo 简单洗牌算法06*/0708$card_num=54;//牌数09print_r(wash_card($card_num));1011functionwash_card($card_num)12{13$cards=$tmp=array();14for($i=0;$i<$card_num;$i++){15$tmp[$i]=$i;16}1718for($i=0;$i<$card_num;$i++){1 阅读全文
posted @ 2013-02-03 14:15 幻星宇 阅读(368) 评论(0) 推荐(0) 编辑