Home > Backend Development > PHP Tutorial > 微信企业号开发php版1-接口验证

微信企业号开发php版1-接口验证

WBOY
Release: 2016-06-23 13:43:35
Original
1267 people have browsed it

普通模式类似公众号的编辑模式,很简单不再介绍,回调模式类似开发模式,略有不同。

下载模板http://qydev.weixin.qq.com/php.zip

接口文件为sample.php进行如下修改,找到corpId,AK和token自己改写或用模板的。提交sample.php路径后,验证成功。

<?php //更改第8行corpID,token和encodingAesKey可选用代码里的参数填写include_once "WXBizMsgCrypt.php";// 假设企业号在公众平台上设置的参数如下$encodingAesKey = "jWmYm7qr5nMoAUwZRjGtBxmz3KA1tkAj3ykkR6q2B2C";$token = "QDG6eK";$corpId = "xxxxxxxxxxxx";//需要更换$sVerifyMsgSig =$_GET["msg_signature"]; $sVerifyTimeStamp =$_GET["timestamp"]; $sVerifyNonce = $_GET["nonce"];$sVerifyEchoStr = $_GET["echostr"];// 需要返回的明文$sEchoStr = "";$wxcpt = new WXBizMsgCrypt($token, $encodingAesKey, $corpId);$errCode = $wxcpt->VerifyURL($sVerifyMsgSig, $sVerifyTimeStamp, $sVerifyNonce, $sVerifyEchoStr, $sEchoStr);if ($errCode == 0) {		echo $sEchoStr;	} else {	print("ERR: " . $errCode . "\n\n");}?>
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template