php中使用GD函数生成计数器
时间:2008-07-16 来源:061107
PHP数组,PHP对象,类型转换
html标签的用法
PHP:Header使用
Header("Content-type: image/jpeg");
$arr = file("counter.txt");
$count = (int)$arr[0];
$fp = fopen("counter.txt","w");
fputs($fp,++$count);
fclose($fp);
$im = ImageCreate(45,16);
$white = ImageColorAllocate($im,255,255,255);
$black = ImageColorAllocate($im,0,0,0);
imagefill($im,1,1,$black);
ImageString($im,5,0,0,sprintf("%05d",$count),$white);
imageJpeg($im);
imagedestroy($im);
?>
相关阅读 更多 +