swoole_table->create [编辑本页]

创建内存表。

swoole_table->create()
  • 创建好表的结构后,执行create后创建表

swoole_table使用共享内存来保存数据,在创建子进程前,务必要执行swoole_table->create()
swoole_server中使用swoole_table,swoole_table->create() 必须在swoole_server->start()前执行

$table = new swoole_table(1024);
$table->column('id', swoole_table::TYPE_INT, 4);       //1,2,4,8
$table->column('name', swoole_table::TYPE_STRING, 64);
$table->column('num', swoole_table::TYPE_FLOAT);
$table->create();

$worker = new swoole_process('child1', false, false);
$worker->start();

//$serv = new swoole_server('127.0.0.1', 9501);
//$serv->start();