forked from dodgepudding/wechat-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dodgepudding#277 from nfer/master
add more comments on getQRCode functions; re-implement some code
- Loading branch information
Showing
3 changed files
with
265 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?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); | ||
|
||
// check null $scene_id | ||
$qrcode = $weObj->getQRCode(); | ||
if ($qrcode != false) { | ||
echo "test failed.\n"; | ||
die(); | ||
} | ||
|
||
// check bad $type | ||
$qrcode = $weObj->getQRCode(123, -1); | ||
if ($qrcode != false) { echo "test failed.\n"; die();} | ||
|
||
// check bad $type | ||
$qrcode = $weObj->getQRCode(123, 5); | ||
if ($qrcode != false) { echo "test failed.\n"; die();} | ||
|
||
// check bad $scene_id | ||
$qrcode = $weObj->getQRCode('ad', 0); | ||
if ($qrcode != false) { echo "test failed.\n"; die();} | ||
|
||
// check bad $scene_id | ||
$qrcode = $weObj->getQRCode('ad', 1); | ||
if ($qrcode != false) { echo "test failed.\n"; die();} | ||
|
||
// check bad $scene_id | ||
$qrcode = $weObj->getQRCode(123, 2); | ||
if ($qrcode != false) { echo "test failed.\n"; die();} | ||
|
||
echo "test passed.\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
include "../wechat.class.php"; | ||
|
||
$options = array( | ||
'token'=>'XXXXXX', //填写你设定的key | ||
'encodingaeskey'=>'XXXXXX', //填写加密用的EncodingAESKey,如接口为明文模式可忽略 | ||
'appid'=>'XXXXXX', //填写高级调用功能的app id | ||
'appsecret'=>'XXXXXX' //填写高级调用功能的密钥 | ||
); | ||
$weObj = new Wechat($options); | ||
|
||
$order = $weObj->getOrderByID("13791169361138306965"); | ||
var_dump($order); | ||
|
||
$order = $weObj->getOrderByFilter(); | ||
var_dump($order); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters