: This article describes how to configure the redis module in XAMPP under win7. if you are interested in the PHP Tutorial, refer to it. 1. use phpinfo () to view the PHP version
My computer shows the result: php 5.6 32-bit.
2. download the php-redis module of the corresponding version,
Put the downloaded php_redis.dll and php_igbinary.dll under xampp/php/ext,
Modify php. ini and add:
extension=php_igbinary.dllextension=php_redis.dll
Restart XAMPP. then, you can see that the redis module is loaded normally in phpinfo.
I encountered many problems during installation. I will summarize them as follows:
1. download the phpredis module of the corresponding php version;
2. check whether it is 32-bit or 64-bit. This depends on the Architecture output by phpinfo (), rather than the number of digits of the operating system.
3. during Download, The-ts-is thread-safe, and The-ns-is non-thread-safe.
4. download from here
III. example
$ Redis = new Redis (); $ redis-> connect ("localhost", "6379"); $ redis-> set ("say", "Hello World "); echo $ redis-> get ("say"); // output Hello World. The program runs successfully.
IV. common operations
// Set key $ redis-> set ('val1', 'ABC'); echo $ redis-> get ('val1 ').'
'; // Delete key $ redis-> del ('val1'); // return TRUE (1) var_dump ($ redis-> get ('Val ')); // return bool (false) // check whether the key exists if (! $ Redis-> exists ('key1') // var_dump ($ redis-> del ('key1') does not exist; // int (0) is returned) // Set the mset set $ array_mset = array ('First _ key' => 'first _ val ', 'second _ key' => 'second _ val ', 'third _ key' => 'third _ val '); $ redis-> mset ($ array_mset); $ array_mget = array ('First _ key ', 'Second _ key', 'third _ key'); var_dump ($ redis-> mget ($ array_mget); // returns array $ redis-> del ($ array_mget ); // Use array to delete multiple keyvar_dump ($ redis-> mget ($ array_mget) at the same time; // returns array (3) {[0] => bool (false) [1] => bool (false) [2] => bool (false )}
The above describes how to configure the redis module in XAMPP under win7, including some content. I hope my friends who are interested in the PHP Tutorial can help me.