Maison >développement back-end >tutoriel php >redis pconnect 的 select db 问题
<code> $r1 = new \Redis(); $r1->pconnect('/redis.sock'); $r1->select(1); $r2 = new \Redis(); $r2->pconnect('/redis.sock'); $r2->select(2); $r2->set('a','r1'); var_dump($r1->get('a')); var_dump($r2->get('a'));</code>
输出都是r1,请问有有效解决方案吗?
<code> $r1 = new \Redis(); $r1->pconnect('/redis.sock'); $r1->select(1); $r2 = new \Redis(); $r2->pconnect('/redis.sock'); $r2->select(2); $r2->set('a','r1'); var_dump($r1->get('a')); var_dump($r2->get('a'));</code>
输出都是r1,请问有有效解决方案吗?
pconnect换成connect