2012-10-23 51 views
2

我有類似這樣的一個問題:phpredis與Redis的去

Connecting to Redis To Go with PHP

基本上,我有這個URI中的Redis去:

的Redis://名爲myUsername:foopassword @青魚.redistogo.com:9998

,我試圖連接到它使用phpredis:

$ R->連接(「Redis的://名爲myUsername:[email protected]米:9998 /「);

它不起作用。在其他答案中,建議使用predis,但我只是不想。我應該可以自由地使用任何我想要的客戶端。

任何想法?

在此先感謝

+0

+1對抗predis; phpredis是一個本地擴展,即使開發不太活躍,它也必然會比predis更高效。 – Mahn

回答

0

我沒有用過redistogo,但也許你可以試試嗎?

$ r-> connect('herring.redistogo.com',9998);
$ r-> auth('myusername:foopassword');

2

使用這個代替:

$r = new Redis(); 
$r->connect("herring.redistogo.com", 9998); 
$r->auth("foopassword"); 

如果還是不行,請嘗試$r->auth("myusername:foopassword")代替。

你可以在the official GitHub page找到phpredis文檔。

+0

這個解決方案爲我工作。 – trimbletodd