Ocrlicense.php 831 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\Ocr;
  4. use app\command\qrd;
  5. use think\App;
  6. class Ocrlicense extends \app\BaseController
  7. {
  8. public $post=[];
  9. public $white=["*"];
  10. public function __construct(App $app)
  11. {
  12. parent::__construct($app);
  13. $this->post =$this->request->post();
  14. }
  15. public function query(){
  16. $img= isset($this->post['img'])&&$this->post['img']!="" ? trim($this->post['img']):"";
  17. if($img==""){
  18. return error_show(1005,"参数img不能为空");
  19. }
  20. $ocr=new Ocr();
  21. $data = $ocr->query("",$img);
  22. if($data['code']==0 && isset($data['data']['result'])){
  23. return app_show(0,"识别成功",$data['data']['result']);
  24. }else{
  25. return error_show(1005,"识别失败");
  26. }
  27. }
  28. }