chawuciren / bytebuffer
Handle binary data in a modern and minimalist way
1.0.2
2019-07-31 06:34 UTC
Requires
- php: >=5.3
- chawuciren/bignumber: 1.0.3
Requires (Dev)
- php: >=5.3
This package is not auto-updated.
Last update: 2025-04-17 10:45:54 UTC
README
php-bytebuffer
关于
使用现代并且简约的方式来处理二进制数据
安装方式
开始安装:
1.安装方式一,通过composer 安装
composer require chawuciren/bignumber
2.安装方式二,直接下载并 include
直接下载源码,引入 src/ByteBuffer.php
开始使用
初始化中传入的数值应使用字符串,譬如有一个取出数值并计算后返回给前端的接口,数据库中存储的类型为 decimal 时,应优先将取出的值初始化为 BigNumber,然后在代码中使用 BigNumber 进行计算,后在接口返回处使用:value() 方法获取字符串型的数值输出
1.方式一:使用 new 语句
use \chawuciren\ByteBuffer;
$buffer = new ByteBuffer('BufferString');
2.方式二:使用静态方法 build
use \chawuciren\ByteBuffer;
$number = ByteBuffer::from('BufferString');
3.方式三:使用 fill 方法赋值
$number = new \chawuciren\BigNumber(10);
$number->fill('BufferString');