Regarding the usage of memcache in thinkphp, including the installation of memcache, how to use it when running in ThinkPHP, and examples of memcache used as cache in thinkphp, friends in need can refer to it.
Memcache cache usage in thinkphp 1. Download and install memcache 1) Install memcache under window. Download memcached.exe to d:/memcached/memcached.exe. Run cmd and enter: d:/memcached/memcached.exe -d install to install. 2), run d:/memcached/memcached.exe -d start to start memcache 3) Download php_memcache.dll to the php installation directory extension directory phpext 4) Modify php.ini and add extension=php_memcache.dll. Restart apache. Check phpinfo.php. If there is a memcache module, it means the installation is successful 2. Use of memcache in thinkphp 1), ThinkPHP/conf/convention.php modify cache type 'DATA_CACHE_TYPE' => 'Memcache', // Data cache type,Support: File|Db|Apc|Memcache|Shmop|Sqlite|Xcache|Apachenote|Eaccelerator 2). Thinkphp official download extension ThinkPHP_Extend_3.1.2/Extend/Driver/Cache/CacheMemcache.class.php and save it to: ThinkPHP/Lib/Driver/Cache/CacheMemcache.class.php 3), test: S('test','memcache');$test = S('test'); echo $test;Output memcache, indicating that the test is successful. |