Created
November 2, 2016 11:57
-
-
Save sourceperl/bb417091171731efb1e2f76fd2b1c5b3 to your computer and use it in GitHub Desktop.
Simple example of Redis usage with PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<?php | |
require 'Predis/Autoloader.php'; | |
Predis\Autoloader::register(); | |
$r = new Predis\Client(); | |
?> | |
<html> | |
<head> | |
<title>Test REDIS</title> | |
</head> | |
<body> | |
<i><u>add Redis PHP lib on debian:</u> sudo apt-get install libphp-predis</i> | |
<br> | |
<br> | |
<b>Redis 'foo' key value:</b> <?php echo $r->get('foo'); ?><br> | |
<b>Value of 'visit' count:</b> <?php echo $r->incr('visit'); ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment