Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use php to cache pictures generated by gd to memcache

Shulou Source: shulou.com Published: 2022-06-03 07:40:44 11月15日 Update

This article mainly introduces how to use php to cache the pictures generated by gd to memcache. The article is very detailed and has a certain reference value. Interested friends must read it!

The code is as follows:

/ / start caching pictures ob_start (); / / enable output caching, temporarily cache the output content imagejpeg ($newimage,false,$quality); / / output $data = ob_get_contents (); / / get the cache ob_end_clean just obtained; / / clear the cache $mem = get_memcache () / / modify $mem- > set ($mem_key,$data,720000) yourself; / / save the output you just obtained to memcache echo $data;// output picture and display it like $mem = get_memcache (); / / modify $data = $mem- > get ($mem_key); if ($data) {echo $data; exit () } the above is all the contents of the article "how to use php to cache pictures generated by gd to memcache". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Caching output pictures content generation articles code value interests guys partners time more knowledge industry information information channels channels references help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft OPPO Reno Shulou Tech Info Redmi Linux