From 5fa07afd1aa35baae0cabcfe96598b451157d4f6 Mon Sep 17 00:00:00 2001 From: lvfan2008 Date: Wed, 11 Jan 2017 18:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=97=A5=E5=BF=97=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/component_app_event.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/example/component_app_event.php b/example/component_app_event.php index 779aa5d..ec750bc 100644 --- a/example/component_app_event.php +++ b/example/component_app_event.php @@ -7,8 +7,12 @@ include_once "config.php"; include_once dirname(dirname(__FILE__)) . "/src/WxComponentService.class.php"; +$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; +log_ex('wx_auth_msg', "component_app_event enter: url:{$url}"); + $cfg = get_wx_config(); if (!$cfg) { + log_ex('wx_auth_msg', "get_wx_config failed!"); die("no access!"); } @@ -18,6 +22,7 @@ $wxComponentService = new WxComponentService($wxComponentConfig, new FileCache($GLOBALS['cacheDir'])); $appId = $cfg['app_id']; +// debug模式,会记录一些日志,正式的时候,可以去掉。 $wxComponentService->getWxComponent()->debug = true; $wxComponentService->getWxComponent()->logcallback = "log_wechat"; @@ -39,6 +44,7 @@ die('no access'); } +// debug模式,会记录一些日志,正式的时候,可以去掉。 $weObj->debug = true; $weObj->logcallback = "log_wechat"; @@ -51,7 +57,7 @@ die($ret); } $weObj->getRev(); -log_ex('wx_auth_msg', "appId:{$appId} receive data:" . $weObj->getRevContent()); +log_ex('wx_auth_msg', "appId:{$appId} receive data:" . print_r($weObj->getRevData(),true)); $weObj->text("success")->reply('', true); // 简单测试回复success log_ex('wx_auth_msg', "echo success"); @@ -127,8 +133,10 @@ function test_auto_case(&$wxComponentService, $appId) die('no access'); } + // debug模式,会记录一些日志,正式的时候,可以去掉。 $weObj->debug = true; $weObj->logcallback = "log_wechat"; + $ret = $weObj->valid(true); if ($ret === false) { log_ex('wx_auth_msg', "appId:{$appId}, auth valid failed! param:" . print_r($_GET, true) . " weObj:" . print_r($weObj, true)); @@ -138,7 +146,7 @@ function test_auto_case(&$wxComponentService, $appId) die($ret); } $weObj->getRev(); - log_ex('wx_auth_msg', "appId:{$appId} receive data:" . $weObj->getRevContent()); + log_ex('wx_auth_msg', "appId:{$appId} receive data:" . print_r($weObj->getRevData(),true)); if ($weObj->getRevType() == Wechat2::MSGTYPE_TEXT) { $recv_txt = $weObj->getRevContent();