Swoole ? MySQL? ??? ??? ???? ???? ??? ??????
Swoole ? MySQL? ??? ??? ???? ????? Swoole? ??? ??? ???? ???? ????? ???? ??? ???? ???? ?? MySQL? ???? ??? ???????. ? ???? ?????? ??? ???? ??? ????.
-
Swoole Server ?? :
WebSocket ?? HTTP ??? ?? ? ??? Swoole ??? ???? ??????. Swoole? Coroutine ?? ????? ??? ?? ?? ?? ??? ????? ?? ? ? ??????.<code class="php">$server = new Swoole\WebSocket\Server("0.0.0.0", 9501); $server->on('open', function($server, $request) { echo "connection open: {$request->fd}\n"; }); $server->on('message', function($server, $frame) { echo "received message: {$frame->data}\n"; $server->push($frame->fd, json_encode(["message" => $frame->data])); }); $server->on('close', function($server, $fd) { echo "connection close: {$fd}\n"; }); $server->start();</code>
-
MySQL? ?? :
Swoole? Coroutine MySQL ?????? ???? ??????? ??????. ? ?????? ? ??? ?????? ??? ????, ?? ??? ???? ? ?????.<code class="php">$db = new Swoole\Coroutine\MySQL(); $db->connect([ 'host' => '127.0.0.1', 'port' => 3306, 'user' => 'username', 'password' => 'password', 'database' => 'database' ]);</code>
-
??? ??? ?? :
Swoole? Coroutine? MySQL? ?? ?? ???? ???? ???? ????? ???????. ?? ??, ? ??? ???? ????? ????? ???? ??? ?????? ??? ??? ? ? ????.<code class="php">$server->on('workerStart', function($server, $workerId) use($db) { Swoole\Timer::tick(1000, function() use($db, $server) { $result = $db->query('SELECT * FROM updates WHERE processed = 0'); foreach($result as $row) { $server->push($row['clientId'], json_encode($row)); $db->query("UPDATE updates SET processed = 1 WHERE id = {$row['id']}"); } }); });</code>
??? ??? ???? ?? Swoole ? MySQL? ??????? ?? ??? ??????
??? ??? ???? ?? Swoole ? MySQL? ?????? ?? ?? ??? ??????.
- ? ??? ????? ??????.
Swoole? ? ??? ???? ?????? ??? ??? ??? ???? ?? ??? ??? ?? ???? ??????. - ?????? ?? ??? :
MySQL ??? ????? ??? ??????. ??? ??, ??? ??? ?? ???? ??? ??? ?? ???????? ?? ?? ?? ?? ??? ??????. - ?? ?? :
?? ???? (? : Redis)? ???? ??????? ??? ????. ?? ?? ??? ??? ?? ?? ????? ???? ???? ??????. - ?? ?? :
Swoole? ?? ??? ???? ?????? ??? ????? ??????. ????? ??? ??? ???? ?? ??? ???? ?? ????? ???? ? ??????. - ??? ? ??? :
Swoole? MySQL? ??? ????? ????????. Swoole? ?? ??? ? MySQL? ?? ???? ?? ??? ???? ?? ??? ???? ?? ?? ???? ??????. - ?? ?? :
???? ???? ? ? MySQL ????? ???? ??? ???? ?????. ?? ???? ??? ?? ??? ?? ? ?.
???? MySQL ??? ???? ?? ?? Swoole ??? ?????????
Swoole? ???? MySQL ??? ???? ????? ?? ??? ?? ??? ????.
- ? ?? :
Swoole? ? ??? ???? ?? ???? ?? ?? ?? ? ?????? ??? ???? ? ?????. - ?? ?? :
? ??? ?????? ?? ?? ???? ? ??? ?? ??? ??? ???? ?? ??? ?? ??? ?? ??? ?? ?? ??????. - ??? ???:
Swoole? ??? API? ???? ??? ? ??? ?? ? ? ???,? ??? ?? ?? ????? ?? ??????? ?? ???? ? ??? ??? ??? ??? ? ? ????. - ? ?? ?? :
WebSocket? ???? ??? ????? ?? ???, ??? ??? ???????, ?? ?? ??? ?? ????? ???? ? ??????. - ??? MySQL ????? :
Swoole? Coroutine MySQL ?????? ? ??? ?????? ??? ????? ??? ?? ?? ???? ???? ? ??????.
MySQL? ??? ????? Swoole? ??? ? ??? ???? ????? ?????????
MySQL? ??? ????? Swoole? ??? ? ??? ??? ?? : ? ?? ??? ?????.
-
?? ?? :
MySQL ????? ??? ?????? ??? ?? ??? ????????.START TRANSACTION
???? ???? ??? ????? ??COMMIT
.<code class="php">$db->query('START TRANSACTION'); $db->query('UPDATE table SET column = value WHERE condition'); $db->query('COMMIT');</code>
- ??? ?? ?? :
?? ????? ??? ???? ?? ???? ?? ????? ??? ?? ?? ???? ??????. ??? ???? ??? ?? ????? ???? ??? ? ????. - ??? ?? Binlog? ??????.
MySQL? ???? ?? (Binlog)? ???? ?? ??????? ?? ??? ???? ? ???? ?? ????? ??? ???? ???? ? ??? ? ????. - idempotency ?? :
???? ??? Idempotent? ????? ??? ??? ?? ? ???? ? ? ???? ?? ??? ??? ????. ?? ?? ???? ???? ???? ?????. - ???? ? ?? :
?? ? ???? ??? ???? ?????? ??? ???? ?? ?? ???? ??????. Swoole? ?? API ? MySQL? ?? ??? ?? ??? ??? ???? ???? ? ??? ? ? ????.
??? ??? ??? Swoole? ??? ??? ???? MySQL? ??? ???? ????? ?? ??? ???? ??? ? ????.
? ??? Swoole ? MySQL? ??? ??? ???? ???? ??? ??????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)