关于php:PHP-Composer拓展包华为云OCR文字识别

介绍

本我的项目集成了华为云OCR文字辨认业务,反对ThinkPHP5.0、ThinkPHP5.1和ThinkPHP6.0,由宁波晟嘉网络科技有限公司保护。

装置教程

应用 composer require singka/singka-hwocr 命令行装置即可。

应用示例(基于ThinkPHP6.0)

<?php
// +----------------------------------------------------------------------
// | 胜家云 [ SingKa Cloud ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.singka.net All rights reserved.
// +----------------------------------------------------------------------
// | 宁波晟嘉网络科技有限公司
// +----------------------------------------------------------------------
// | Author: ShyComet <shycomet@qq.com>
// +----------------------------------------------------------------------
namespace app\home\controller;

use SingKa\HwOcr\HwOcr;

class Index extends Base
{
    /**
    * OCR文字辨认示例
    *
    * @appKey       华为云appKey
    * @appSecret    华为云appSecret
    * @regionName   资源所在区域
    */
    public function ocrDemo()
    {
        $config['appKey'] = 'YXMWB********PKZY';
        $config['appSecret'] = 'wC2*em*7*********EDP';
        $config['regionName'] = 'cn-north-4';
        //别离传入配置、OCR辨认类型、图片地址或Base64码和其余参数
        $result = HwOcr::AkskRequest($config, 'business-license', 'http://tuoxing.shop/ocr/data/business-license-demo.jpg', []);
        return json(json_decode($result, true));
    }
  
}

其余阐明

相干资料请查阅:
华为云文字辨认、SDK简介、API概览

更多内容请拜访作者集体网站 尘墨成

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理