PHP code example of webguosai / cryptojs-aes

1. Go to this page and download the library: Download webguosai/cryptojs-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/ */

    

webguosai / cryptojs-aes example snippets


use \Webguosai\Aes;

$array = [
    'name1' => '123',
    'name2' => '456'
];
$key   = 'key4567890123456';
$iv    = 'iv34567890123456';

//加密
$encode = Aes::encrypt($array, $key, $iv); // dc530b22204d3ee7ce729062600fb5c389c43ededed5e5c12d22b82a791fc15e

//解密
$data   = Aes::decrypt($encode, $key, $iv); // ['name1' => '123', 'name2' => '456']