Caching images generated by gd to memcahe_PHP tutorial

WBOY
Release: 2016-07-14 10:10:30
Original
794 people have browsed it

print?//Start caching images

          ob_start();//Enable output caching and temporarily cache the content to be output

Imagejpeg($newimage,false,$quality);//Output

          $data = ob_get_contents();//Get the cache just obtained

        ob_end_clean();//Clear the cache

         $mem =get_memcache();//Modify it yourself

           $mem->set($mem_key,$data,720000);//Save the output just obtained into memcache

          echo $data;//Output picture

          Then it’s displayed like this

         $mem = get_memcache();//Modify it yourself
$data = $mem->get($mem_key);

If($data) {

                 echo $data;

exit();

         } 

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477491.htmlTechArticleprint?//Start caching images ob_start();//Enable output caching and temporarily cache the content to be output imagejpeg($newimage,false,$quality);//Output $data = ob_get_contents();//Get just...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!