将条形码读取器生成/读取与Codeigniter集成


Integrate barcode reader generate/read with Codeigniter

有人能想到带Codeigniter的条形码阅读器吗?

系统应该生成存储在数据库中的条形码,并能够读取。

您可以使用第三方php条形码生成器,就像gith hub上提供的一样https://github.com/picqer/php-barcode-generator使用它,您可以创建如下所示的打印函数。这是一个小片段,你必须在这里添加你自己的内容

<?php
function print()
{
include(APPPATH.'third_party/php-barcode-generator/src/BarcodeGenerator.php');
include(APPPATH.'third_party/php-barcode-generator/src/BarcodeGeneratorPNG.php');
include(APPPATH.'third_party/php-barcode-generator/src/BarcodeGeneratorSVG.php');
include(APPPATH.'third_party/php-barcode-generator/src/BarcodeGeneratorHTML.php');
$generatorPNG = new Picqer'Barcode'BarcodeGeneratorPNG();
$generatorSVG = new Picqer'Barcode'BarcodeGeneratorSVG();
$generatorHTML = new Picqer'Barcode'BarcodeGeneratorHTML();
$data = $this->model_name->model_function_name();   
foreach ($data as $value) {
echo '<img style="width: 200px;height: 50px" src="data:image/png;base64,'.base64_encode($generatorPNG->getBarcode($value->column_name, $generatorPNG::TYPE_CODE_128)).'">'
}
}
?>

上面的模型返回从数据库中提取的数据,使用这些数据将其转换为条形码并显示为图像。希望这个片段能帮助你开发自己的