全部产品

热搜和底纹Demo

下列展示了热搜和底纹的实例:

require_once("../OpenSearch/Autoloader/Autoloader.php");

use OpenSearch\Client\OpenSearchClient;

$accessKeyId = '<替换为 AK >';
$secret = '<替换为 AK secret>';
$endPoint = '<替换为 endpoint>';
$appName = '<替换为 应用名称>';
$options = array('debug' => true);
$modelName = '<替换为 热搜/底纹模型名称>';//非必填

$client = new OpenSearchClient($accessKeyId, $secret, $endPoint, $options);

$uri = "/apps/{$appName}/actions/hot"; //此处为热搜的url,如果是底纹的话,请将hot改为hint
$params = [];
$params['hit'] = 10;
$params['sort_type'] = 'default';
$params['user_id'] = '1231453';
$params['model_name'] = $modelName;//此处为热搜/底纹的模型名称,非必填

try{
    $ret = $client->get($uri, $params);
    print_r(json_decode($ret->result, true));
}catch (\Throwable $e) {
    print_r($e);
}