<?php
$redis = new Redis();
$redis->connect( ‘127.0.0.1‘, 6379 )or die( "could net connect redis server" );
$connect = mysql_connect( ‘127.0.0.1‘, ‘root‘, ‘12345678‘ );
mysql_set_charset( ‘utf8‘, $connect );
mysql_select_db( table );
$query = "select * from user1 limit 3";
$result = mysql_query( $query );
while ( $row = mysql_fetch_assoc( $result ) ) {
json_encode( $row, JSON_UNESCAPED_UNICODE );
$id= $row[‘id‘];
$redis->rpush( $id, $row[‘id‘] );
$redis->rpush( $id, $row[‘age‘] );
$redis->rpush( $id, $row[‘name‘] );
$redis->rpush( $id, $row[‘detail‘] );
$data = $redis->lrange( $id ,0,-1);
echo "number is <b><font color=#FF0000>$id</font></b>";
echo "<br>";
print_r($data);
// echo "detail is <b><font color=#FF0000>$data</font></b>";
echo "<br>";
}
?>