PHP code example of zhuyanxun / aes
1. Go to this page and download the library: Download zhuyanxun/aes library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhuyanxun / aes example snippets
$aes_key = "J0^P^)0-ZriSt93g";
$aes_iv = "B8jNhk5J49(@mM++";
$method = "AES-128-CBC";
$aes = new Aes($aes_key,$aes_iv,$method);
//默认字符串
$strings = "hello world!";
//加密
$result1 = $aes->encrypt($strings);
//解密
$result2 = $aes->decrypt($result1);
print_r(array(
'default' => $strings,
'encrypt' => $result1,
'decrypt' => $result2,
));