1、在TP3.2里面,写一个控制器,用来校验微信公众号||小程序的服务器地址
-
<?php
-
namespace Home\Controller;
-
use Think\Controller;
-
header('Content-type:text');
-
define("TOKEN", "x**");
-
-
class XiaoKeFuController extends Controller {
-
public function index(){
-
if (isset($_GET['echostr'])) {
-
$this->valid();
-
}else{
-
$this->responseMsg();
-
}
-
}
-
-
public function valid()
-
{
-
$echoStr = $_GET["echostr"];
-
if($this->checkSignature()){
-
header('content-type:text');
-
echo $echoStr;
-
exit;
-
}else{
-
echo $echoStr.'+++'.TOKEN;
-
exit;
-
}
|