久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php怎么實(shí)現(xiàn)身份證OCR識(shí)別

      實(shí)現(xiàn)身份證OCR識(shí)別的方法:1、申請(qǐng)開(kāi)通身份證OCR識(shí)別接口,獲取API請(qǐng)求KEY;2、調(diào)用接口API,通過(guò)“function juhecurl($url,$params=false,$ispost=0){…}”方式發(fā)出請(qǐng)求,處理數(shù)據(jù)并返回結(jié)果;3、獲取接口返回內(nèi)容,并用json_decode()解析成數(shù)組;4、打印返回結(jié)果。

      php怎么實(shí)現(xiàn)身份證OCR識(shí)別

      php入門(mén)到就業(yè)線上直播課:進(jìn)入學(xué)習(xí)
      Apipost = Postman + Swagger + Mock + Jmeter 超好用的API調(diào)試工具:點(diǎn)擊使用

      本教程操作環(huán)境:windows7系統(tǒng)、PHP8.1版、DELL G3電腦

      基于PHP的身份證OCR識(shí)別接口調(diào)用示例

      申請(qǐng)接口

      接口備注:識(shí)別身份證正面或反面的一些關(guān)鍵字

      通過(guò) https://www.juhe.cn/docs/api/id/287?s=cpphpcn 自助申請(qǐng)開(kāi)通接口,獲取API請(qǐng)求KEY

      請(qǐng)求參數(shù)

      名稱(chēng) 必填 說(shuō)明
      key 在個(gè)人中心->我的數(shù)據(jù),接口名稱(chēng)上方查看
      image 圖像數(shù)據(jù),base64編碼(不包含data:image/jpeg;base64,),要求base64編碼后大小不超過(guò)4M,最短邊至少15px,最長(zhǎng)邊最大4096px,支持jpg/png/bmp格式
      side front:正面識(shí)別;back:反面識(shí)別;

      PHP示例代碼

      其中將證件圖片轉(zhuǎn)為base64字符串請(qǐng)參考 https://www.sdk.cn/details/vOVl36qOLmlV8E9WXJ

      $apiurl="http://apis.juhe.cn/idimage/verify";//請(qǐng)求地址 $key = "";//32位的KEY $image= "";//圖片base64后字符串 $side="front";//正反面 $params=compact('key','image','side');//組合請(qǐng)求參數(shù) $content=juhecurl($apiurl,$params,1);//post請(qǐng)求獲取接口返回內(nèi)容json字符串 $result = json_decode($content,true);//解析成數(shù)組 if($result){     if($result['error_code']=='0'){         print_r($result);     }else{         echo $result['error_code'].":".$result['reason'];     } }else{     echo "請(qǐng)求失敗"; }  //網(wǎng)絡(luò)請(qǐng)求方法  function juhecurl($url,$params=false,$ispost=0){         $httpInfo = array();         $ch = curl_init();           curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );         curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 3);         curl_setopt( $ch, CURLOPT_TIMEOUT , 8);         curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );         if ($params) {             if (is_array($params)) {                 $paramsString = http_build_query($params);             } else {                 $paramsString = $params;             }         } else {             $paramsString = "";         }            if( $ispost )         {             curl_setopt( $ch , CURLOPT_POST , true );             curl_setopt( $ch , CURLOPT_POSTFIELDS , $paramsString);             curl_setopt( $ch , CURLOPT_URL , $url );         }         else         {             if($paramsString ){                 curl_setopt( $ch , CURLOPT_URL , $url.'?'.$paramsString);             }else{                 curl_setopt( $ch , CURLOPT_URL , $url);             }         }         $response = curl_exec( $ch );         if ($response === FALSE) {             //echo "cURL Error: " . curl_error($ch);             return false;         }         $httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE );         $httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );         curl_close( $ch );         return $response; }
      登錄后復(fù)制

      JSON返回示例

      身份證正面識(shí)別結(jié)果示例: { "reason": "成功", "result":{          "realname": "張三",/*姓名*/          "sex": "男",/*性別*/          "nation": "侗",/*民族*/          "born": "19760613",/*出生日期*/          "address": "貴州省都勻市甘塘鎮(zhèn)長(zhǎng)紅機(jī)器廠散居戶(hù)169號(hào)",/*地址*/          "idcard": "522701197606131935",/*身份證號(hào)*/          "side": "front",/*正面*/          "orderid": 339057896/*本次查詢(xún)流水號(hào)*/           }, "error_code": 0 } -------------------------------------------------------------------------------------------- 身份證背面識(shí)別結(jié)果示例: { "reason": "成功", "result":{      "begin": "20130501",/*簽發(fā)日期*/      "department": "東臺(tái)市公安局",/*簽發(fā)機(jī)關(guān)*/      "end": "20180501",/*失效日期*/       "side": "back",/*反面*/      "orderid": 478799279/*本次查詢(xún)流水號(hào)*/           }, "error_code": 0 }
      登錄后復(fù)制

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)