You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
642 B
30 lines
642 B
<?php
|
|
/**
|
|
* 微信公共接口测试
|
|
*
|
|
*/
|
|
include("../wechat.class.php");
|
|
|
|
function logdebug($text){
|
|
file_put_contents('../data/log.txt',$text."\n",FILE_APPEND);
|
|
};
|
|
$options = array(
|
|
'token'=>'tokenaccesskey', //填写你设定的key
|
|
'debug'=>true,
|
|
'logcallback'=>'logdebug'
|
|
);
|
|
$weObj = new Wechat($options);
|
|
$weObj->valid();
|
|
$type = $weObj->getRev()->getRevType();
|
|
switch($type) {
|
|
case Wechat::MSGTYPE_TEXT:
|
|
$weObj->text("hello, I'm wechat")->reply();
|
|
exit;
|
|
break;
|
|
case Wechat::MSGTYPE_EVENT:
|
|
break;
|
|
case Wechat::MSGTYPE_IMAGE:
|
|
break;
|
|
default:
|
|
$weObj->text("help info")->reply();
|
|
}
|
|
|