【php开源代码栏目提醒】:网学会员为需要php开源代码的朋友们搜集整理了EXA3-2.PHP相关资料,希望对各位网友有所帮助!
<?php
Header("Content-type: image/gif");
//定义输出的类型为图形
$fp = fopen("zzm.txt", "r");
$str1 = fgets($fp,10);
$str1++;
fclose($fp);
$fp = fopen("zzm.txt", "w");
fputs($fp, $str1);
fclose($fp);
$len1 = strlen($str1);
$str2 = "000000000";
$len2 = strlen($str);
$dif = $len2 - $len1;
$rest = substr($str2, 0, $dif);
$string = $rest.$str1;
//上面这些代码与exa3-1.php完全相同
$font = 4;
//定义字号
$im = imagecreate(88,31);
//新建图象
$background_color = ImageColorAllocate($im, 20,100,40);
//定义黑色
$foreground_color = ImageColorAllocate($im, 255,30,150);
//定义白色
imagefill($im, 0,0,$background_color);
//把计数器的底色设置成黑色
$px = (imagesx($im)-8.3*strlen($string))/2;
//根据字串的长度,计算字串开始写入的水平坐标,目的是尽量让字串水平对中
ImageString($im,3,$px,2,"E&J Counter",$foreground_color);
//向图象写入"E&J Counter"
imageline($im, 1, 14, 85, 14, $foreground_color);
//划一根水平线
ImageString($im,$font,$px,15.5,$string,$foreground_color);
//写访问人数
Imagepng($im);
//把图象输出成GIF格式
ImageDestroy($im);
//释放图象
?>
上一篇:
EXA3-1.PHP
下一篇:
成本管理背景指导