Skip to content

Commit 4461f5e

Browse files
committed
Add example for mysql unix socket.
1 parent 024f205 commit 4461f5e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
go(function(){
4+
$db = new Swoole\Coroutine\Mysql;
5+
$server = [
6+
'host' => 'unix:/tmp/mysql.sock',
7+
'user' => 'root',
8+
'password' => 'root',
9+
'database' => 'test'
10+
];
11+
$db->connect($server);
12+
$stmt = $db->prepare('SELECT * FROM `user` WHERE id=?');
13+
$ret = $stmt->execute([1]);
14+
var_dump($ret);
15+
});

0 commit comments

Comments
 (0)