function intClearUser(&$smarty, $user_id, $username, $ras_ip, $unique_id_val) { $req = new KillUser($user_id, $ras_ip, $unique_id_val, FALSE); $resp = $req->sendAndRecv(); if ($resp->isSuccessful()) { $smarty->assign("clear_success", TRUE); } else { $resp->setErrorInSmarty($smarty); } face($smarty, $username); }
'Title'=>'开发人员通道', 'Description'=>'开发人员通道', 'PicUrl'=>'http://233.weego.sinaapp.com/images/weego_400_200.png', 'Url'=>'http://233.weego.sinaapp.com/web/home.php?wxid='.$fromUsername ) ); } $weObj->news($news)->reply(); exit; break; case Wechat::MSGTYPE_EVENT: break; case Wechat::MSGTYPE_IMAGE: /**********图片信息**********/ $imgUrl = $weObj->getRev()->getRevPic(); $resultStr = face($imgUrl); $weObj->text($resultStr)->reply(); break; default: $weObj->text("Default")->reply(); } // 调用人脸识别的API返回识别结果 function face($imgUrl) { // face++ 链接 $jsonStr = file_get_contents("http://apicn.faceplusplus.com/v2/detection/detect?url=".$imgUrl."&api_key=5eb2c984ad24ffc08c352bdb53ee52f8&api_secret=ViX19uvxkT_A0a6d55Hb0Q0QGMTqZ95f&&attribute=glass,pose,gender,age,race,smiling"); $replyDic = json_decode($jsonStr); $resultStr = ""; $faceArray = $replyDic->{'face'}; $resultStr .= "图中共检测到".count($faceArray)."张脸!\n";