PHP code example of coco-project / base64
1. Go to this page and download the library: Download coco-project/base64 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/ */
coco-project / base64 example snippets
use Coco\base64\Base64;
$instance = Base64::getInstance($key['key'], $key['padding']);
$str = 'hello 你好 123456';
$s = $instance->encode($str);
echo $s;
echo PHP_EOL;
echo $instance->decode($s);
echo PHP_EOL;
// ";xn+;YIOp-IO"BR.48qr'yF!Ioo
// hello 你好 123456
use Coco\base64\Base64;
$str = 'hello 你好 123456';
$s = $instance->encode($str);
echo $s;
echo PHP_EOL;
$s1 = base64_encode($str);
echo $s1;
echo PHP_EOL;
//aGVsbG8g5L2g5aW9IDEyMzQ1Ng==
//aGVsbG8g5L2g5aW9IDEyMzQ1Ng==