使用tencentcloud-sdk-php
进行通用印刷体识别(GeneralBasicOCR),您需要先确保已经按照上述步骤安装了该SDK,并在腾讯云控制台上获取了您的SecretId和SecretKey。
代码开始:
<?php
require 'vendor/autoload.php'; // 根据您的项目结构引入autoload文件
use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Ocr\V20181119\OcrClient;
use TencentCloud\Ocr\V20181119\Models\GeneralBasicOCRRequest;
// 设置您的SecretId和SecretKey
$secretId = '您的SecretId';
$secretKey = '您的SecretKey';
try {
// 初始化用户身份信息(secretId, secretKey)
$cred = new Credential($secretId, $secretKey);
// 初始化Http选项
$httpProfile = new HttpProfile();
$httpProfile->setEndpoint("ocr.tencentcloudapi.com");
// 初始化客户端配置
$clientProfile = new ClientProfile();
$clientProfile->setHttpProfile($httpProfile);
// 实
标签:tencentcloud,识别,印刷体,clientProfile,完整版,GeneralBasicOCR,php,sdk
From: https://blog.csdn.net/u014765393/article/details/136909367