PHP code example of laocc / gds

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

    

laocc / gds example snippets


server  {
    listen 80;
    server_name img.kaibuy.top;
    root  /home/web/blog/upload;

    error_page 404 =200 /index.php;
    set $real_root $document_root;
    fastcgi_intercept_errors on;

    location = /index.php {
        root  /home/web/blog/public/www;
        try_files $uri = 404;
        

$code = [];
$code['code'] = microtime(true);        //条码内容
$code['font'] = null;       //字体,若不指定,则用PHP默认字体
$code['size'] = 10;         //字体大小
$code['label'] = false;     //条码下面标签是否需要个性化,也就是分割并在两头加星号,若=null,则不显示标签
$code['pixel'] = 3;         //分辨率即每个点显示的像素,建议3-5
$code['height'] = 20;       //条码部分高,实际像素为此值乘pixel
$code['style'] = null;      //条码格式,可选:A,B,C,或null,若为null则等同于C
$code['root'] = _ROOT . 'code/';    //保存文件目录,不含在URL中部分
$code['path'] = 'code1/';   //含在URL部分
$code['save'] = false;      //是否保存为文件,否则只显示
\gd\Code1::create($code);