url:https://jinyuanea.cn/MsgPush/demo1.php
可以正常访问
PHP代码如下:
<?php
/**
* wechat php test
*/
//define your token
define("TOKEN", "*******");
$wechatObj = new wechatCallbackapiTest();
$wechatObj->valid();
class wechatCallbackapiTest
{
public function valid()
{
$echoStr = $_GET['echostr'];
//valid signature , option
if($this->checkSignature()){
echo $echoStr;
exit;
}
}
private function checkSignature()
{
// you must define TOKEN by yourself
if (!defined($_GET['echostr'])) {
echo "TOKEN is not defined!";
}
$signature = $_GET['signature'];
$timestamp = $_GET['timestamp'];
$nonce = $_GET['nonce'];
$token = TOKEN;
$tmpArr = array($token, $timestamp, $nonce);
// use SORT_STRING rule
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
echo $_GET['echostr'];
}else{
echo false;
}
}
}
?>
请问配置的这个服务器URL必须是线上地址吗,测试环境怎么联调测试呢?