A small example of php caching images generated by gd to memcache_PHP tutorial

WBOY
Release: 2016-07-21 15:09:36
Original
888 people have browsed it

Copy the code The code is as follows:

//Start caching images 

 ob_start();//Enable output caching, 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 the picture

Then display it like this

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

if($data) {

echo $data;

exit( );

}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327297.htmlTechArticleCopy the code The code is as follows: //Start caching images ob_start();//Enable output caching, which will be output temporarily The content is cached imagejpeg($newimage,false,$quality);//Output $data = ob_ge...
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!