入队操作
01
02 $redis = new Redis();
03 $redis->connect('127.0.0.1',6379);
04 while(True){
立即学习“PHP免费学习笔记(深入)”;
05 try{
06 $value = 'value_'.date('Y-m-d H:i:s');
07 $redis->LPUSH('key1',$value);
08 sleep(rand()%3);
09 echo $value."\n";
10 }catch(Exception $e){
11 echo $e->getMessage()."\n";
12 }
13 }
14 ?>
出队操作
01
02 $redis = new Redis();
03 $redis->pconnect('127.0.0.1',6379);
04 while(True){
立即学习“PHP免费学习笔记(深入)”;
05 try{
06 echo $redis->LPOP('key1')."\n";
07 }catch(Exception $e){
08 echo $e->getMessage()."\n";
09 }
10 sleep(rand()%3);
11
}?>
摘自 zhuangge
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号