Demo.php 619 字节
<?php

include_once "wxBizDataCrypt.php";

class Demo extends \app\common\controller\Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = '*';

    public function vi()
    {
        $appid = 'wx55afbe753b153a68';
        $sessionKey = $_REQUEST['session_key'];
        $encryptedData = $_REQUEST['encryptedData'];
        $iv = $_REQUEST['iv'];

        $pc = new WXBizDataCrypt($appid, $sessionKey);
        $errCode = $pc->decryptData($encryptedData, $iv, $data);

        if ($errCode == 0) {
            print($data . "\n");
        } else {
            print($errCode . "\n");
        }
    }
}