繁体   English   中英

Php-Redis问题

[英]Php-Redis Issue

我已经安装了Redis,Php和Php-Redis,现在当我在程序下面运行该程序时,

<?php
   //Connecting to Redis server on localhost
   $redis = new Redis();
   $redis->connect('127.0.0.1', 6379);
   echo "Connection to server sucessfully";
   //check whether server is running or not
   echo "Server is running: "+ $redis->ping();
?>

理想的输出应该是

成功连接到服务器服务器正在运行:PONG

但是输出iam得到

成功连接到服务器

问题可能在哪里?

您应该更改此:

echo "Server is running: "+ $redis->ping();

对此:

echo "Server is running: " . $redis->ping();

因为。 运算符用于串联,+运算符用于加法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM