另一篇php实现百度人脸识别
话不多说,直接开撸
public function upimg2(){
$image = $_FILES['upimg']['tmp_name'];
$content = curl_file_create($image, 'image/jpeg', 'test.jpg');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api-cn.faceplusplus.com/facepp/v3/detect" ,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST =>"POST",
CURLOPT_POSTFIELDS => array(
'image_file' => $content,
'api_key' => "你的api_key",