国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ?? ??? ?? ?? PHP WeChat ?? ? WeChat ???? ?? ?? ???? ???? ??

PHP WeChat ?? ? WeChat ???? ?? ?? ???? ???? ??

Mar 21, 2017 pm 04:10 PM

? ??? ???? ???? WeChat ???? ?? ??? ?? ??? ?? ????, ???? ???? ???? ?? ?? ? ??? ?? ?? ???? ?? ?? ? ????. >WeChat ?? ??:

?? WeChat ????

?? ??

?? ???? ??? WeChat ??? ?? ???? ?? ???? ?????. ??? ??? ????

XML

??? ??? ???? ??? ?, ? XML ??? ??? ???? POST ???? ?? ??? URL? ?????. ?? 1: $_POST

??

?? $GLOBALS["HTTP_RAW_POST_DATA"]? ???? POST ???? ???? ??? ?????? ??:

POST? XML,

SOAP

?? ??????/?? ??? ?? ???? ?? ?? ??? ??? ??? ? ????. . ??? $GLOBALS["HTTP_RAW_POST_DATA"]? $_POST? ?????. PHP? POST ???? ??? ? ??? $GLOBALS["HTTP_RAW_POST_DATA"]? ???? ?? ?? ? ????.

?? 2:

simplexml

_load_file()? ????? ???? ?????? ?:

???? ??

string

: XML string ? ???? ???.

class

: ??? ??? ???? ? ????, ????? ??? XML ??? ???? ???? ?? "SimpleXMLElement"? ?????. ??: ?? Libxml ????? ?????. ?????

??

LIBXML_NOCDATA? ?????. ?? CDATA? ??? ??? ????? ?????. ns: ????? ??

is_prefix: ????? ??

??? ?? ? SimpleXMLElement ???? ??? ?????. ??: ?? ??? ?? ???? ???? ?? ?? ??? ????.

<span style="font-family:Courier New;font-size:14px;"><?php 
define("TOKEN","weixin"); 
$weixinObj = new Wechat(); 
$weixinObj->valid();?
class?Wechat{?
public?function?valid(){?
$echoStr?=?$_GET['echostr'];?
//如果是第一次接入?
if($this->checkSignature()?&&?$echoStr?){?
echo?$echoStr;?
exit;?
}else{?
$this->responseMsg();?
}?
}?
//校驗(yàn)方法?
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;?
}?
}?
/*?普通文本消息?
<xml>?
<ToUserName><![CDATA[toUser]]></ToUserName>?
<FromUserName><![CDATA[fromUser]]></FromUserName>?
<CreateTime>1348831860</CreateTime>?
<MsgType><![CDATA[text]]></MsgType>?
<Content><![CDATA[this is a test]]></Content>?
</xml>?
*/?
public?function?responseMsg(){?
//獲取微信服務(wù)器POST請(qǐng)求中的數(shù)據(jù)?
$postStr?=?$GLOBALS["HTTP_RAW_POST_DATA"];?
if(?!empty($postStr)?){?
$postObj?=?simplexml_load_string($postStr,?'SimpleXMLElement',?LIBXML_NOCDATA);?
$fromUser?=?$postObj->FromUserName;?
$toUser?=?$postObj->ToUserName;?
$keyword?=?trim($postObj->Content);?
$time?=?time();?
$template?=?"<xml>?
<ToUserName><![CDATA[%s]]></ToUserName>?
<FromUserName><![CDATA[%s]]></FromUserName>?
<CreateTime>%s</CreateTime>?
<MsgType><![CDATA[%s]]></MsgType>?
<Content><![CDATA[%s]]></Content>?
</xml>";?
if(?strtolower($postObj->MsgType)!='text'?){?
$msgType?=?"text";?
$content?=?"我只接受文本消息";?
}else{?
$msgType?=?"text";?
if(?!empty($keyword)?){?
$content?=?"您發(fā)送的消息是:".$postObj->Content;?
}else{?
$content?=?"請(qǐng)輸入關(guān)鍵字";//消息為空?
}?
}?
$info?=?sprintf($template,?$fromUser,?$toUser,?$time,?$msgType,?$content);?
echo?$info;?
}else{?
echo?"";?
exit;?
}?
}?
}</span>

??: ?? ??? ?? ???? ???? ?? ???? ?? ??? ????.

<span style="font-family:Courier New;font-size:14px;"><?php 
define("TOKEN","weixin"); 
$weixinObj = new Wechat(); 
$weixinObj->valid();?
class?Wechat{?
public?function?valid(){?
$echoStr?=?$_GET['echostr'];?
//如果是第一次接入?
if($this->checkSignature()?&&?$echoStr?){?
echo?$echoStr;?
exit;?
}else{?
$this->responseMsg();?
}?
}?
//校驗(yàn)方法?
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;?
}?
}?
/*?接收?qǐng)D片消息格式?
<xml>?
<ToUserName><![CDATA[toUser]]></ToUserName>?
<FromUserName><![CDATA[fromUser]]></FromUserName>?
<CreateTime>1348831860</CreateTime>?
<MsgType><![CDATA[image]]></MsgType>?
<PicUrl><![CDATA[this is a url]]></PicUrl>?
<MediaId><![CDATA[media_id]]></MediaId>?
<MsgId>1234567890123456</MsgId>?
</xml>?
*/?
public?function?responseMsg(){?
//獲取微信服務(wù)器POST請(qǐng)求中的數(shù)據(jù)?
$postStr?=?$GLOBALS["HTTP_RAW_POST_DATA"];?
if(?!empty($postStr)?){?
$postObj?=?simplexml_load_string($postStr,?'SimpleXMLElement',?LIBXML_NOCDATA);?
$fromUser?=?$postObj->FromUserName;?
$toUser?=?$postObj->ToUserName;?
$time?=?time();?
$msgType=?$postObj->MsgType;?
$picUrl?=?$postObj->PicUrl;?
$mediaId?=?$postObj->MediaId;?
$template?=?"<xml>?
<ToUserName><![CDATA[%s]]></ToUserName>?
<FromUserName><![CDATA[%s]]></FromUserName>?
<CreateTime>%s</CreateTime>?
<MsgType><![CDATA[%s]]></MsgType>?
<Content><![CDATA[%s]]></Content>?
</xml>";?
if(?strtolower($msgType)!='image'?){?
$msgType?=?"text";?
$content?=?"我只接受圖片消息";?
}else{?
$msgType?=?"text";?
if(?!empty(?$picUrl?)?){?
$content?=?"圖片鏈接為:".$picUrl."\n";?
$content?.=?"媒體id:".$mediaId;?
}else{?
$content?=?"請(qǐng)發(fā)送圖片";//消息為空?
}?
}?
$info?=?sprintf($template,?$fromUser,?$toUser,?$time,?$msgType,?$content);?
echo?$info;?
}else{?
echo?"";?
exit;?
}?
}?
}</span>

? ??? WeChat ???? ???? ??? ? ???? ?? ??? ?? ???? ??? ?????. ???? ??? ??? ????!

? ??? PHP WeChat ?? ? WeChat ???? ?? ?? ???? ???? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???