我在Java中有这段代码,它使用AES 128位将源String加密为Base64加密值.但是我找不到类似的PHP函数产生相同的结果.任何帮助将不胜感激
String key = "1234567890123456";
String source = "The quick brown fox jumped over the lazy dog";
byte[] raw = key.getBytes();
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
// Instantiate the cipher
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(source.getBytes());
System.out.println(new String(Base64.encodeBase64(encrypted)));
Run Code Online (Sandbox Code Playgroud)