常见问题
错误码 | 错误标识 | 解决方法 |
---|---|---|
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<body>
<script>
var jsondata ={"image": "图片的base64"};//非常重要的一步;
$.ajax(
{
type: "post",
url: "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/classification/hwnum?access_token=YOURSELFTOKEN",
data:JSON.stringify(jsondata),
contentType : "application/json",
success: function (data) {
console.log(JSON.stringify(data));
}
}
)
</script>
</body>
</html>
public function styleImgType($image, $options) {
$data = array();
$data['image'] = base64_encode($image);
$data = array_merge($data, $options);
$data = json_encode($data);
$headers['Content-Type'] = 'application/json';
return $this->request($this->styleImgTypeUrl, $data, $headers);
}