# swoole_base **Repository Path**: dingxiaoxu/swoole_base ## Basic Information - **Project Name**: swoole_base - **Description**: my swoole init ---------- - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-01-15 - **Last Updated**: 2024-05-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### pdo ``` use App\Ws; use App\Db; $dbpool = Ws::$dbPool; go(function () use ($dbpool) { $db = new Db($dbpool); // 查询一条 $oneRet = $db::get( 'select wr_id, wr_subject from g5_write_toon_c where ca_name like :like and wr_id > :wr_id', [':like' => '%무협%', ':wr_id' => 20] ); var_dump($oneRet); // 查询多条 $allRet = $db::all( 'select wr_id, wr_subject from g5_write_toon_c where ca_name like :like and wr_id > :wr_id', [':like' => '%무협%', ':wr_id' => 20] ); var_dump($allRet); // 插入数据 $insertId = $db::insert("insert into m_test (name, other) values (:name, :other)", [':name' => 'dq', ':other' => 111125]); print $insertId; // 更新数据 $updateCount = $db::update("update m_test set name = :newName where name = :curName", [":newName" => 'zcj', "curName" => 'zcj1']); print $updateCount; // 删除数据 $deleteCount = $db::delete("delete from m_test where id > :id", [":id" => 5]); print $deleteCount; }); ``` ### redis ``` use App\Ws; $redisPool = Ws::$redisPool['r1']; go(function () use ($redisPool) { $redis = $redisPool->get(); $today = $redis->hget('toon_today', 2); $redisPool->put($redis); var_dump($today); }); ``` ### table ``` use App\Ws; // 插入 Ws::$table::get('fdTable')->set($fd, ['id' => $fd, 'name' => "zzz_{$fd}"]) // 查询 $count = Ws::$table::get('fdTable')->count(); print "count: {$count}"; foreach (Ws::$table::get('fdTable') as $item) { print "name: {$item['name']} \r\n"; } // 删除 del(); // 某个key是否存在 exist(); ```