简体   繁体   English

Php-Redis问题

[英]Php-Redis Issue

I had installed Redis, Php and Php-Redis and now when i run this below program iam getting 我已经安装了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();
?>

The ideal output should be 理想的输出应该是

Connection to server sucessfully Server is running: PONG 成功连接到服务器服务器正在运行:PONG

but the ouput iam get 但是输出iam得到

Connection to server sucessfully 成功连接到服务器

where could be the issue? 问题可能在哪里?

You should change this: 您应该更改此:

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

to this: 对此:

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

Because the . 因为。 operator is for Concatenation, and the + operator is for addition. 运算符用于串联,+运算符用于加法。

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

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