php对接阿里日志SLS系统遇到的一些问题
composer update 时报错
有人建议
composer update --ignore-platform-reqs
--ignore-platform-reqs 这个是忽略php版本匹配的意思(当你的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