......
public function responseMsg(){
$postStr=$GLOBALS["HTTP_RAW_POST_DATA"];
if(!empty($postStr)){
$postObj=simplexml_load_string($postStr,'SimpleXMlElement',LIBXML_NOCDATA);
$fromUsername=$postObj->FromUserName;
$toUsername=$postObj->ToUserName;
$type=$postObj->MsgType;
$customrevent=$postObj->Event;
$latitude=$postObj->Location_X;
$longitude=$postObj->Location_Y;
$keyword=trim($postObj->Content);
$time=time();
$textTpl="<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[%s]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[news]]></MsgType>
<ArticleCount>1</ArticleCount>
<Articles>
<item>
<Title><![CDATA[刮刮乐]]></Title>
<Description><![CDATA[]]></Description>
<PicUrl><![CDATA[http://weixin.com/gg1.jpg]]></PicUrl>
<Url><![CDATA[%s]]></Url>
</item>
</Articles>
<FuncFlag>0</FuncFlag>
</xml>"
//图文
$num=rand(1,10);//设置随机函数
if($keyword=="刮刮乐"){
if($num=="1"){
$url="http://weixin.com/1.html";
}elseif($num=="2" or $num=="3"){
$url="http://weixin1234.duapp.com/2.html";
}elseif($num>3 and $num<7){
$url="http://weixin.com/3.html";
}else{
$url="http://weixin.duapp/4.html";
}
$resultStr=sprintf($textTpl,$fromUsername,$toUsername,$time,$url);
echo $resultStr;
}
}
}
......
刮刮乐
最新推荐文章于 2022-09-28 17:03:39 发布