简体   繁体   English

如何使用 PHP 验证各种条形码编码?

[英]How can I validate diverse barcode encodings using PHP?

I'm tasked with validating GTIN-14, GTIN-13, GTIN-12, GTIN-8 and UPC-E barcodes.我的任务是验证 GTIN-14、GTIN-13、GTIN-12、GTIN-8 和 UPC-E 条码。 I have seen a few functions here and there, however I'm unclear on how to validate the code without knowing ahead of time which standard is in use.我在这里和那里看到了一些函数,但是我不清楚如何在不提前知道正在使用的标准的情况下验证代码

I assume this must be possible, but I'm at a loss as to where I should begin.我认为这一定是可能的,但我不知道应该从哪里开始。

Validating the content of the barcode shouldn't be a problem. 验证条形码的内容应该不是问题。 Take a look at the specification for the different GTIN-Formats. 看一下不同GTIN-Formats的规范 The problematic part is to check the existence of the required GS1 Symbol identifier. 有问题的部分是检查是否存在所需的GS1符号标识符。 The commonly used libs for barcode decoding (zxing, zbar) do not give you the Symbol identifier. 常用的条形码解码库(zxing,zbar)不会为您提供符号标识符。 The only exception is zxing for Code-128. 唯一的例外是Code-128的zxing。 If you have to check other carrier types you will have to look into commercial decoders. 如果您必须检查其他运营商类型,您将不得不考虑商业解码器。 Take a look at this question for more details. 请查看此问题以获取更多详细信息。

Check out https://github.com/ronanguilloux/IsoCodes 查看https://github.com/ronanguilloux/IsoCodes

It provides validators for GTIN-14, GTIN-13, GTIN-12, GTIN-8 and more 它为GTIN-14,GTIN-13,GTIN-12,GTIN-8等提供验证器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM