警告:一定分两个文件
1. 1.php
<?php header("content-type:text/html;charset=utf-8"); $redis=new Redis(); $redis->connect('127.0.0.1',6379); $arr=array('a','n','g','l'); foreach($arr as $key=>$val) { $redis->rPush('zz',$val); }
2. 2.php
<?php header("content-type:text/html;charset=utf-8"); $redis=new Redis(); $redis->connect('127.0.0.1',6379); $value = $redis->lpop('zz'); if($value){ echo "出队的值".$value; }else{ echo "出队完成"; }