Properties

$accessTokenUrl

$accessTokenUrl : string

获取access token url

Type

string

$reportUrl

$reportUrl : string

反馈接口

Type

string

$appId

$appId : string

appId

Type

string

$apiKey

$apiKey : string

apiKey

Type

string

$secretKey

$secretKey : string

secretKey

Type

string

$scope

$scope : array

权限

Type

array

$advancedGeneralUrl

$advancedGeneralUrl : string

通用物体识别 advanced_general api url

Type

string

$dishDetectUrl

$dishDetectUrl : string

菜品识别 dish_detect api url

Type

string

$carDetectUrl

$carDetectUrl : string

车辆识别 car_detect api url

Type

string

$logoSearchUrl

$logoSearchUrl : string

logo商标识别 logo_search api url

Type

string

$logoAddUrl

$logoAddUrl : string

logo商标识别—添加 logo_add api url

Type

string

$logoDeleteUrl

$logoDeleteUrl : string

logo商标识别—删除 logo_delete api url

Type

string

$animalDetectUrl

$animalDetectUrl : string

动物识别 animal_detect api url

Type

string

$plantDetectUrl

$plantDetectUrl : string

植物识别 plant_detect api url

Type

string

$objectDetectUrl

$objectDetectUrl : string

图像主体检测 object_detect api url

Type

string

Methods

__construct()

__construct(string  $appId, string  $apiKey, string  $secretKey) 

Parameters

string $appId
string $apiKey
string $secretKey

getVersion()

getVersion() : string

查看版本

Returns

string

setConnectionTimeoutInMillis()

setConnectionTimeoutInMillis(integer  $ms) 

连接超时

Parameters

integer $ms

毫秒

setSocketTimeoutInMillis()

setSocketTimeoutInMillis(integer  $ms) 

响应超时

Parameters

integer $ms

毫秒

setProxies()

setProxies(  $proxies) : string

代理

Parameters

$proxies

Returns

string

report()

report(  $feedback) : array

反馈

Parameters

$feedback

Returns

array

advancedGeneral()

advancedGeneral(string  $image, array  $options = array()) : array

通用物体识别接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

dishDetect()

dishDetect(string  $image, array  $options = array()) : array

菜品识别接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

carDetect()

carDetect(string  $image, array  $options = array()) : array

车辆识别接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

logoSearch()

logoSearch(string  $image, array  $options = array()) : array

logo商标识别接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

logoAdd()

logoAdd(string  $image, string  $brief, array  $options = array()) : array

logo商标识别—添加接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
string $brief
  • brief,检索时带回。此处要传对应的name与code字段,name长度小于100B,code长度小于150B
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

logoDeleteByImage()

logoDeleteByImage(string  $image, array  $options = array()) : array

logo商标识别—删除接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

logoDeleteBySign()

logoDeleteBySign(string  $contSign, array  $options = array()) : array

logo商标识别—删除接口

Parameters

string $contSign
  • 图片签名(和image二选一,image优先级更高)
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

animalDetect()

animalDetect(string  $image, array  $options = array()) : array

动物识别接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

plantDetect()

plantDetect(string  $image, array  $options = array()) : array

植物识别接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

objectDetect()

objectDetect(string  $image, array  $options = array()) : array

图像主体检测接口

Parameters

string $image
  • 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
array $options
  • 可选参数对象,key: value都为string类型

Returns

array

proccessRequest()

proccessRequest(string  $url, array  $params, array  $data, array  $headers) 

处理请求参数

Parameters

string $url
array $params
array $data
array $headers

request()

request(string  $url, mixed  $data,   $headers = array()) : mixed

Api 请求

Parameters

string $url
mixed $data
$headers

Returns

mixed

multi_request()

multi_request(string  $url, mixed  $data) : mixed

Api 多个并发请求

Parameters

string $url
mixed $data

Returns

mixed

validate()

validate(string  $url, array  $data) : \mix

格式检查

Parameters

string $url
array $data

Returns

\mix

proccessResult()

proccessResult(  $content) : mixed

格式化结果

Parameters

$content

string

Returns

mixed

isPermission()

isPermission(array  $authObj) : boolean

判断认证是否有权限

Parameters

array $authObj

Returns

boolean

getAuthFilePath()

getAuthFilePath() : string

返回 access token 路径

Returns

string

writeAuthObj()

writeAuthObj(array  $obj) : void

写入本地文件

Parameters

array $obj

readAuthObj()

readAuthObj() : array

读取本地缓存

Returns

array

auth()

auth(boolean  $refresh = false) : array

认证

Parameters

boolean $refresh

是否刷新

Returns

array

getAuthHeaders()

getAuthHeaders(string  $method, string  $url,   $params = array(),   $headers = array()) : array

Parameters

string $method

HTTP method

string $url
$params
$headers

Returns

array