1 / 10
文档名称:

微信开发者验证方法及程序.doc

格式:doc   大小:57KB   页数:10页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

微信开发者验证方法及程序.doc

上传人:小博士 2019/1/8 文件大小:57 KB

下载得到文件列表

微信开发者验证方法及程序.doc

相关文档

文档介绍

文档介绍:微信开发者验证方法及程序微信公众平台接口开发验证程序?URL、TOKEN认证2种方式成为开发者的第一步就是填写URL、TOKEN信息,来对你服务器进行验证把下面代码复制并保存为一个php文件()<?php/***wechatphptest*///defineyourtokendefine("TOKEN"/weixin"h$wechatObj=newwechatCallbackapiTest();$wechatObj->valid();classwechatCallbackapiTest{publicfunctionvalid(){$echoStr=$_GET["echostr"];//validsignature,optionif($this->checkSignature()){echo$echoStr;exit;}}publicfunctionresponseMsg(){//getpostdata'Maybeduetothedifferentenvironments$postStr=$GLOBALS["HTTP—RAW_POST_DATA"];//extractpostdataif(!empty($postStr)){$postObj=simplexml_load_string($postStr,LIBXML_NOCDATA);'SimpleXMLElement',$fromUsername=$postObj->FromUserName;$toUsername=$postObj->ToUserName;$keyword=trim($postObj->Content);$time=time();$textTpl=',<xml><Tol)serName><![CDATA[%s]]></ToUserName><FromUserName><![CDATA[%s]]></FromUserName><CreateTime>%s</CreateTime><MsgType><![CDATA[%s]]></MsgType><Content><![CDATA[%s]]></Content><FuncFlag>O</FuncFlag>if(!empty($keyword)){$msgType="textu;$contentStr="etowechatworld!";$resultStr=sprintf($textTpl/$fromUsername,$toUsername/$time/$msgType,$contentStr);echo$resultStr;}else{echo"Inputsomething...H;}}else{echo"";exit;}}privatefunctioncheckSignature(){$signature=$_GET["signature"];$timestamp=$_GET["timestamp"];$nonce=$_GET[Hnonce"];$token=T