Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据解析的时候如果数据里有大括号就会出错需要修改为如下 #2

Open
soitif opened this issue May 30, 2018 · 0 comments

Comments

@soitif
Copy link

soitif commented May 30, 2018

protected static function _decryptMsg($body, $encodeKey)
    {
        $enc_msg = base64_decode($body);
        $aes_key = base64_decode($encodeKey . '=');
        $secure_key = substr($aes_key, 0, 32);
        $iv = substr($aes_key, 0, 16);
        $msg = openssl_decrypt($enc_msg, 'AES-256-CBC', $secure_key, OPENSSL_RAW_DATA, $iv);
        //$pattern = '/.*(\{.*\})/'; //原正则
        $pattern = "/[^\{]*(\{.*\})/i";
        $msg = preg_replace($pattern, '${1}', $msg);
        return $msg;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant