Redis实现注册、删除、编辑、分页功能( 二 )

编辑功能
doedit.php
<?php require('redis.php'); $uid = $_POST['uid']; $username = $_POST['username']; $age = $_POST['age']; $a=$redis->hmset("user:".$uid,array("username"=>$username,"age"=>$age)); if($a){ header("location:list.php"); }else{ header("location:mod.php?id=".$uid); }加关注
addfans.php
<?php
//关注功能,建议用集合实现,因为集合元素唯一,并且可以容易求出两个用户粉丝之间交集与差集,进而进行好友推荐功能
$id = $_GET['id'];
$uid = $_GET['uid'];
require("redis.php");
$redis->sadd("user:".$uid.":following",$id);
$redis->sadd("user:".$id.":followers",$uid);
header("location:list.php");

【Redis实现注册、删除、编辑、分页功能】


推荐阅读