本篇文章介绍了ThinkPHP使用Redis实现电商秒杀的处理方法,具有一定的参考价值,希望对学习ThinkPHP的朋友有帮助! TP5使用Redis处理电商秒杀 1.首先在TP5中创建抢购活动所需要的Redis类库文件,代码如下: <php namespace app\base\service; use mikkle\tp_redis\RedisHashInfoBase; use think\Exception; class ScheduleDetail extends RedisHashIn
方法1: Controller <?php namespace app\index\controller; use think\Controller; use think\session\driver\Redis; class Index extends Controller { public function index() { $redis = new Redis(); if(!$redis->has('str')){ var_dump($redis->set('str','this