|
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
define("TOKEN", "******");
define("WEIXIN_APPID", "*******");
define("WEIXIN_SECRET", "*******");
class Home extends Home_Controller {
public $CI;
public function __construct() {
parent::__construct();
$this->CI = &get_instance();
}
public function valid()
{
$echostr = $this->CI->input->get('echostr');
if($this->checkSignature()){
echo $echoStr;
exit;
}
}
private function checkSignature()
{
$signature = $this->CI->input->get('signature');
$timestamp = $this->CI->input->get('timestamp');
$nonce = $this->CI->input->get('nonce');
$token = TOKEN;
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
return true;
}else{
return false;
}
}
public function index()
{
if (isset($this->CI->input->get['echostr'])) {
$this->valid();
}else{
//$wechatObj->responseMsg();
//$wechatObj->responseMsg2();
//$wechatObj->responseMsg3();
}
}
}
1、 填入微信平台URLhttp://www.hzcookie.com/weixin/index.php/home/index/;个人觉得这个地址是不是有问题?
2、2.0直接使用 $_GET,应该是没有问题吧。但好像都获取不到参数?
|
|