The jpg-config.inc.php configuration is as follows:
Define (' Use_cache ', TRUE);
Define (' Read_cache ', true);
Define (' Cache_dir ', ' C:/Program files/www/oa/ywtj/tmp/jpgraph_cache/');
The script is as follows:
Include (".. /examples/jpgraph/jpgraph.php ");
Include (".. /examples/jpgraph/jpgraph_bar.php ");
$datay =array (1,2,3,4);//Ordinate data
$datax =array (a,b,c,d);//Horizontal data
foreach ($usernums as $key = = $value) {
$datay [] = $value;
$datax [] = $userids [$key];
}
$graph = new Graph (800,600, ' Auto ', 1); Cache time is 1 minutes ************
$graph->setscale ("Textlin");
$graph->xaxis->setticklabels ($datax);
$graph->xaxis->setfont (ff_verdana,fs_normal,10);
$graph->xaxis->setlabelangle (30);
$graph->yaxis->scale->setgrace (20);
$graph->xaxis->scale->setgrace (20);
$graph->setshadow ();
$graph->img->setmargin (40,30,20,40);
$bplot = new Barplot ($datay);
$bplot->setfillcolor (' orange ');
$bplot->value->show ();
$bplot->value->setfont (ff_arial,fs_bold,10);
$bplot->value->setangle (45);
$bplot->value->setformat ('%d ');
$graph->add ($bplot);
$graph->title->set ("Utilization Statistics of optical cable");
$graph->xaxis->title->set ("Business department name");
$graph->yaxis->title->set ("operating department occupancy");
$graph->xaxis->title->setfont (Ff_simsun,fs_bold);
$graph->yaxis->title->setfont (Ff_simsun,fs_bold);
$graph->title->setfont (Ff_simsun,fs_bold);
$graph->stroke ();
On the first visit, a copy picture is generated in the cache folder, and on the 2nd visit, the generated copy picture byte is 0 and the 3rd access error appears.
Reply to discussion (solution)
Can't delete cached images?
The file name is empty, how can I delete it?
This thing is very unstable, use caution.
Thank you moderator, it indicates that the cache image can not be deleted, the principle of the actual application of the cache should be the first time to return the picture to the browser also generate copy to the cache, the 2nd visit should be access to the cache and determine, based on the length of the cache copy to determine whether to return the browser or update the cache, But I feel in the application, no matter at any time to access the program, all write to the cache, the first generation of the picture copy, but the 2nd time the picture copy updated to 0 bytes, more puzzled.
No, it's a knot.