当前位置: 代码迷 >> 综合 >> php swoole table 共享内存 入门
  详细解决方案

php swoole table 共享内存 入门

热度:85   发布时间:2023-10-10 21:22:01.0

案例1

<?php
/*** table.php* 文件描述* created on 23:33 2022/3/3 23:33* create by xiflys*/
// 创建内存表
use Swoole\Table as TableAlias;$table = new TableAlias(1024);# 内存表增加列$table->column('id',TableAlias::TYPE_INT,4);
$table->column('money',TableAlias::TYPE_FLOAT,4);
$table->column('name',TableAlias::TYPE_STRING,64);$table->create();$table->set("hello_fly",array('id'=>1,'money'=>10.1,'name'=>'fly'));$arr = $table->get('hello_fly');
var_dump($arr);
[root@996a3fae2cbc memory]# php8016 table.php
array(3) {["id"]=>int(1)["money"]=>float(10.1)["name"]=>string(3) "fly"
}
  相关解决方案