函数名称:Swoole\Buffer::expand()
适用版本:Swoole 4.3.0+
函数说明:Swoole\Buffer::expand() 用于扩展 Swoole\Buffer 的内存大小。
用法:
Swoole\Buffer::expand(int $size)
参数:
返回值:
示例:
// 创建一个初始大小为 1024 字节的 Swoole\Buffer 对象
$buffer = new Swoole\Buffer(1024);
// 扩展内存大小为 2048 字节
$buffer->expand(2048);
// 获取当前 Buffer 的内存大小
$size = $buffer->capacity;
echo "当前 Buffer 大小:" . $size . " 字节\n";
注意事项: