<?php/**Enter your Tendis instance private IP, port number, instance ID, and password in the following parameters*/$host = "192.xx.xx.2";$port = 6379;$pwd = "123tj6na";$redis = new Redis();// Connect to the Tendis instanceif ($redis->connect($host, $port) == false) {die($redis->getLastError());}// Authenticateif ($redis->auth($pwd) == false) {die($redis->getLastError());}/**You can start manipulating the Tendis instance. For more information, please visit https://github.com/phpredis/phpredis. */// Set the keyif ($redis->set("redis", "tencent") == false) {die($redis->getLastError());}echo "set key redis suc, value is:tencent\\n";// Get the key$value = $redis->get("redis");echo "get key redis is:".$value."\\n";?>

Feedback