<?php
// 本类由系统自动生成,仅供测试用途
class IndexAction extends Action {
public function index(){
$timestamp=$_GET['timestamp'];
$nonce=$_GET['nonce'];
$token="weixin";
$signature=$_GET['signature'];
$array=array($timestamp,$nonce,$token);
sort($array);
//2.将排序后的三个参数拼接之后用sha1加密
$temstr=implode('',$array);
$temstr=sha1($temstr);
//3.将加密后的字符串与signature进行对比,判断该请求是否来自微信
if($temstr==$signature){
echo $_GET['echostr'];
exit;
}
}
}
?>
一瞬儿光