0
点赞
收藏
分享

微信扫一扫

php对接阿里日志SLS系统遇到的一些问题

php对接阿里日志SLS系统遇到的一些问题

composer update 时报错

有人建议​​composer update --ignore-platform-reqs​​ --ignore-platform-reqs 这个是忽略php版本匹配的意思(当你的PHP不高时候,不要轻易使用这个命令)

但是这个使用方法有风险;可能一些 插件版本过高,在项目里面会出现异常,或报错;

单独引入sdk:

composer require alibabacloud/aliyun-log-php-sdk

部署流水线

git checkout master
git pull origin master
git checkout ${COMMIT_ID}
#更新composer 依赖
composer config --no-plugins allow-plugins.topthink/think-installer true
#--no-plugins配置允许不安装插件
composer update
git checkout .#避免引起下次的问题提交冲突

日志Sdk注意事项:

  • 当键值为NULL 会报错;
  • 当日志的content 里面有二维数组时,会报strlen错误

sls.proto.php文件需要更新

public function size() {
$size = 0;
if (!is_null($this->key_)) {
$l = strlen($this->key_);
$size += 1 + Protobuf::size_varint($l) + $l;
}
if (!is_null($this->value_)) {
if (is_array($this->value_))
{
$this->value_ = json_encode($this->value_,JSON_UNESCAPED_UNICODE);
}
$l = strlen($this->value_);
$size += 1 + Protobuf::size_varint($l) + $l;
}
return $size;
}

如何查询:

  • nottopic: 访问记录日志 andtopic: "api/Crm/saveStudent" and phone:18500001111

作者:​​刘俊涛的博客​​​,

举报

相关推荐

0 条评论