dynamsoftsamples/php-barcode-com-component

Dynamsoft Barcode Reader SDK for PHP - 将条码识别功能集成到您的应用中

v1.0.1 2016-01-28 06:11 UTC

This package is not auto-updated.

Last update: 2024-09-20 09:31:44 UTC


README

这是用于制作PHP条码阅读器的COM组件

入门指南

  1. 创建一个名为test的新项目。在项目根目录下,创建两个php文件 - test.php和readbarcode.php。然后将SDK包中的dynamsoftbarcodereader.php复制到项目文件夹中。

  2. 按以下方式编辑test.php:

    <html>
    <head/>
    <body>
        <h1>Dynamsoft Barcode Reader PHP Simple Sample</h1>
        <form action="readbarcode.php" method="post" enctype="multipart/form-data">
            Select barcode image:
            <input type="file" name="barcodefile" id="barcodefile" accept="image/*" /><br/>
            <input type="submit" value="Read Barcode" name="submit"/>
        </form>
    </body>
    </html>
    

    按以下方式编辑readbarcode.php:

    <?php
    include "dynamsoftbarcodereader.php";
    
    $uploadfile = $_FILES["barcodefile"]["tmp_name"];
    
    $br = new BarcodeReader();
    $br->initLicense("<your license key here>");
    $br->decodeFile($uploadfile);
    
    $cnt = $br->getBarcodesCount();
    echo "Barcode Count: $cnt <br />";
    for ($i = 0; $i < $cnt; $i++) {
        $res = $br->getBarcodeResult($i);
        echo "$i. $res->BarcodeFormatString , $res->BarcodeText<br />";
    }
    ?>
    

    请将 <您的许可证密钥位置> 替换为有效值。许可证可以在 [安装文件夹]\LicenseManager.exe 中找到。

  3. 假设您将示例部署到WampServer,请将test文件夹复制到 [WampServer根路径]\www文件夹。启动您的WampServer,并访问 http://[ip]:[port]/test/test.php 以验证是否正常工作。

    **注意:** 如果您收到“找不到类'COM'”错误,请检查php.ini中是否启用了COM扩展。

    extension=php_com_dotnet.dll