本文介绍了集成条码阅读器生成/读取与Codeigniter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以想到有关使用Codeigniter的条形码阅读器吗?

Can anyone have idea regarding Barcode Reader with Codeigniter?

系统应该生成存储在DB中的条形码,并且能够读取它。

The system should generate barcode which is store in DB, and able to read it.

推荐答案

您可以使用gith hub上提供的第三方php条形码生成器
使用这个你可以创建打印功能,如下所示。这是一个小片段,您必须在此添加自己的内容

You can use third party php barcode generator like one provided on gith hub https://github.com/picqer/php-barcode-generatorusing this you can create print function like one given below. this is a small snippet you have to add content of your own here

<?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)).'">'
}
}
?>

上面的模型返回从数据库获取的数据,显示为图像。希望此代码段可以帮助您开发自己的

Above the model returns the data which are fetched from the database using which it is converted into the barcode and displayed as an image. Hope this snippet will help you to develop your own,

这篇关于集成条码阅读器生成/读取与Codeigniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 08:05