PHP code example of dingdayu / baidu-bce-ocr-sdk
1. Go to this page and download the library: Download dingdayu/baidu-bce-ocr-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dingdayu / baidu-bce-ocr-sdk example snippets
date_default_timezone_set('UTC');
$tempfile = "./love.png";
$file_content = file_get_contents($tempfile);
$ret = \BaiduBCE\OCR::general($file_content);
var_dump($ret);
date_default_timezone_set('UTC'); // 设置当前时区为UTC
$tempfile = "./love.png";
$file_content = file_get_contents($tempfile); // 读取文件,另可用fopen
$ret = \BaiduBCE\OCR::general($file_content);
var_dump($ret);