PHP code example of soonio / redemption-code

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

    

soonio / redemption-code example snippets


const CHARS = [
    'H', 'I', 'J', 'K', 'L', '8', '9',
    '3', '4', '5', 'O', 'P', 'Q', 'G',
    'V', 'W', '1', '2', 'X', 'Y', 'Z',
    'A', 'B', 'C', 'D', 'S', 'T', 'U',
    '6', '7', 'M', 'N', 'R', 'E', 'F',
];


$rc = new soonio\rc\RedemptionCode(CHARS, 20);

echo "redemption code: {$rc->generate()}\n";

$bool = (new soonio\rc\RedemptionCode(CHARS, 20))->verify('I7AXXDN2TZXPQT788GV3');
echo $bool ? "验证通过\n" : "验证拒绝";
shell
 php examples/index.php