Ocr.php 507 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace app\controller;
  3. use think\facade\Request;
  4. use think\response\Json;
  5. class Ocr extends CommonController
  6. {
  7. public function submit():Json
  8. {
  9. $file = Request::file('file');
  10. if ($file->getSize() > (4*1024*1024)){
  11. return $this->_json_error('文件不能超过4M!');
  12. }
  13. print_r($file);die;
  14. $text = CommonController::callOcr($file);
  15. $data = CommonController::formatTestSheet($text);
  16. return $this->_json_succ($data);
  17. }
  18. }