le2le/aliyun-log

此包的最新版本(1.0)没有可用的许可证信息。

1.0 2020-09-28 06:52 UTC

This package is auto-updated.

Last update: 2024-09-28 20:35:43 UTC


README

阿里云官方SDK(https://github.com/aliyun/aliyun-log-php-sdk)的composer版本

composer require le2le/aliyun-log


$endpoint= 'http://cn-shenzhen.log.aliyuncs.com';
$accessKeyId = '1';
$accessKey = '2';
$project = '3';
$logstore = '4';
$token= '';
$client = new Le2le\AliyunLog\Client($endpoint, $accessKeyId, $accessKey,$token);

$topic = 'TestTopic';

$array = [['342423']];
$logitems = [];
foreach ($array as $one)
{
$logItem = new \Le2le\AliyunLog\Models\LogItem();
$logItem->setTime(time());
$logItem->setContents($one);
$logitems[] = $logItem;
}

$request = new Le2le\AliyunLog\Models\Request\PutLogsRequest($project, $logstore,
$topic, null, $logitems);

$response = '';
try {
$response = $client->putLogs($request);
} catch (Le2le\AliyunLog\Exception $ex) {

var_dump($ex);
} catch (\Exception $ex) {

var_dump($ex);
}

var_dump($response);