PHP code example of lsys / validcode

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

    

lsys / validcode example snippets



use LSYS\ValidCode;
vc=\LSYS\ValidCode\DI::get()->valid_code();
$code=$vc->get_code($key);
//自定义
// $mycode=rand(1111,9999);
// $code=$code->set_save_time(3600)->set_code($mycode);
//内部生成
$code_txt=$code
//设置保存时间
->set_save_time(3600)
//保存30秒内创建不变,默认为0 即每次生成不同
->create_code(30)->get_code();
//发送给客户


//客户体检校验码
//获取校验码,与客户提交的进行对比
var_dump($code->get_code());