💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# swoole_table->create 创建内存表。 ```php function swoole_table->create() : bool; ``` * 定义好表的结构后,执行`create`向操作系统申请内存,创建表 * 调用`create`之前不能使用`set`、`get`等数据读写操作方法 * 调用`create`之后不能使用`column`方法添加新字段 * 系统内存不足,申请失败,`create`返回`false` * 申请内存成功,`create`返回`true` > `swoole_table`使用共享内存来保存数据,在创建子进程前,务必要执行`swoole_table->create()` > `swoole_server`中使用`swoole_table`,`swoole_table->create()` 必须在`swoole_server->start()`前执行 ```php $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(); ``` 内存尺寸 ---- 使用`create`方法创建表后,可以读取`$table->memorySize`属性获取实际占用内存的尺寸,单位为字节。 ```php echo $table->memorySize; ```