实例结构:
1. index.html
Test with embedded image
2. buildcode.php
setScale(2); // Resolution $code->setThickness(30); // Thickness $code->setForegroundColor($color_black); // Color of bars $code->setBackgroundColor($color_white); // Color of spaces $code->setFont($font); // Font (or 0) $code->parse($text); // Text} catch(Exception $exception) { $drawException = $exception;}/* Here is the list of the arguments1 - Filename (empty : display on screen)2 - Background color */$drawing = new BCGDrawing('', $color_white);if($drawException) { $drawing->drawException($drawException);} else { $drawing->setBarcode($code); $drawing->draw();}// Header that says it is an image (remove it if you save the barcode to a file)header('Content-Type: image/png');header('Content-Disposition: inline; filename="barcode.png"');// Draw (or save) the image into PNG format.$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);?>
3. barcode 类库下载地址: ~
效果:
;