Ocrlicense.php 806 B

1234567891011121314151617181920212223242526272829303132
  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 function __construct(App $app)
  10. {
  11. parent::__construct($app);
  12. $this->post =$this->request->post();
  13. }
  14. public function query(){
  15. $img= isset($this->post['img'])&&$this->post['img']!="" ? trim($this->post['img']):"";
  16. if($img==""){
  17. return error_show(1005,"参数img不能为空");
  18. }
  19. $ocr=new Ocr();
  20. $data = $ocr->query("",$img);
  21. if($data['code']==0 && isset($data['data']['result'])){
  22. return app_show(0,"识别成功",$data['data']['result']);
  23. }else{
  24. return error_show(1005,"识别失败");
  25. }
  26. }
  27. }