作者 王智

daima

<?php
namespace app\api\controller;
include_once "wxBizDataCrypt.php";
class Demo extends \app\common\controller\Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = '*';
include_once "wxBizDataCrypt.php";
public function vi()
{
$appid = 'wx55afbe753b153a68';
$sessionKey = $_REQUEST['session_key'];
$encryptedData = $_REQUEST['encryptedData'];
$iv = $_REQUEST['iv'];
/**
* sessionKey/encryptedData/iv参数均从url中获取,并赋给相应变量
*/
$appid = 'xxxxxxxx';
$sessionKey = $_REQUEST['session_key'];
$encryptedData=$_REQUEST['encryptedData'];
$iv = $_REQUEST['iv'];
$pc = new WXBizDataCrypt($appid, $sessionKey);
$errCode = $pc->decryptData($encryptedData, $iv, $data);
$pc = new WXBizDataCrypt($appid, $sessionKey);
$errCode = $pc->decryptData($encryptedData, $iv, $data );
if ($errCode == 0) {
print($data . "\n");
} else {
print($errCode . "\n");
}
}
if ($errCode == 0) {
print($data . "\n");
} else {
print($errCode . "\n");
}
?>
\ No newline at end of file
... ...