src/Core/Helper.php
static function encrypt($data, $op = 'DECODE', $key = '!@#%c*r&o*s^s%p$h~p&', $method = 'AES-256-CBC')
    {
        $encrypt_key = md5($key);
        if ($op == 'ENCODE') {
            $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($method));
            $encrypted = openssl_encrypt($data, $method, $encrypt_key, 0, $iv);
            $result = str_replace(array('=', '/', '+'), array('', '-', '_'), base64_encode($encrypted . '::' . $iv));
        } else {
            $data = base64_decode(str_replace(array('-', '_'), array('/', '+'), $data));
            list($encrypted, $iv) = explode('::', $data);
            $result = openssl_decrypt($encrypted, $method, $encrypt_key, 0, $iv);
        }

        return $result;
    }
static function encrypt($data, $op = 'DECODE', $key = '!@#%c*r&o*s^s%p$h~p&', $method = 'AES-256-CBC')
    {
        $encrypt_key = md5($key);
        if ($op == 'ENCODE') {
            $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($method));
            $encrypted = openssl_encrypt($data, $method, $encrypt_key, 0, $iv);
            $result = str_replace(array('=', '/', '+'), array('', '-', '_'), base64_encode($encrypted . '::' . $iv));
        } else {
            $data = base64_decode(str_replace(array('-', '_'), array('/', '+'), $data));
            list($encrypted, $iv) = explode('::', $data);
            $result = openssl_decrypt($encrypted, $method, $encrypt_key, 0, $iv);
        }

        return $result;
    }
加解密

@param string $data
@param string $op
@param string $key
@param string $method
@return mixed|string