我很难弄清楚如何将以下代码转换为PHP;
const envelope = JSON.stringify({ v: value, a: Cryptiles.randomString(2) });
const cipher = Crypto.createCipher('aes256', key);
let enc = cipher.update(envelope, 'utf8', 'binary');
enc += cipher.final('binary');
return (new Buffer(enc, 'binary')).toString('base64').replace(/\+/g, '-').replace(/\//g, ':').replace(/\=/g, '');
有什么想法吗?