< ? php require_once 'vendor/autoload.php';
use TencentCloud\\ Common\\ Credential;
use TencentCloud\\ Common\\ Profile\\ ClientProfile;
use TencentCloud\\ Common\\ Profile\\ HttpProfile;
use TencentCloud\\ Common\\ Exception\\ TencentCloudSDKException;
use TencentCloud\\ Ims\\ V20201229\\ ImsClient;
use TencentCloud\\ Ims\\ V20201229\\ Models\\ ImageModerationRequest;
try {
$cred = new Credential("SecretId", "SecretKey");
$httpProfile = new HttpProfile();
$httpProfile - > setEndpoint("ims.tencentcloudapi.com");
$clientProfile = new ClientProfile();
$clientProfile - > setHttpProfile($httpProfile);
$client = new ImsClient($cred, "ap-guangzhou", $clientProfile);
$req = new ImageModerationRequest();
$params = array();
$req - > fromJsonString(json_encode($params));
$resp = $client - > ImageModeration($req);
print_r($resp - > toJsonString());
} catch (TencentCloudSDKException $e) {
echo $e;
}
本页内容是否解决了您的问题?