Mac MAMP Redis

  • 下载redis
brew install homebrew/php/php56-redis


点击菜单 --> File --> Edit Template --> PHP --> PHP 5.6.10 php.ini
extension=/usr/local/Cellar/php56-redis/2.2.7_1/redis.so
        $redis = new Redis();

        $options = array();
        $options['host'] = '127.0.0.1';
        $options['port'] = '6379';
        $redis->connect('', $options);
        echo "Connection to server sucessfully";
        //设置 redis 字符串数据
        $redis->set("tutorial-name", "Redis tutorial");
        // 获取存储的数据并输出
        echo "Stored string in redis:: " . $redis->get("tutorial-name");die;

你可能感兴趣的:(Mac MAMP Redis)