1. view界面:test.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<center>
<img src="xianhua.png"/>
</center>
<center>
<span>秒杀开启了</span>
<p>库存量:10 </p>
<p>价格:999元 </p>
</center>
<center>
<button>秒杀</button>
</center>
</body>
</html>
2.初始化队列:start-ms.php
<?php
//1. 开启秒杀活动 创建一个队列
$rd=new Redis(); //
// 2. 连接Redis
$rd->connect("127.0.0.1","6379");
// 3. 创建队列 lpush 从left 往队列里 添加值
for($i=1;$i<4;$i++){
$rd->lpush("mslist",$i);
}
echo "hzminc.com write ms start ...@test18580";
?>
3.出队列:doms.php
<?php
// 点击秒杀按钮 执行的php 脚本 处理秒杀功能
$rd=new Redis(); //
// 2. 连接Redis
$rd->connect("127.0.0.1","6379");
// 3. 出队列