麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
一個簡單的圖像計數器類
悬赏分:20 - 2007年08月22日

[php]
<?
/* filename = icount.php */
define("COUNT_FILE", "count.txt");
define("COUNT_FONT", "2");

function ConvertColor($hexVal)
{
$ColorVal = array(3);
for($i = 0; $i < 3; $i++)
$ColorVal[$i] = HexDec(substr($hexVal, $i * 2, 2));
return $ColorVal;
}

function addCount()
{
$fp = fopen(COUNT_FILE, "r");
$count = fgets($fp, 10);
fclose($fp);
$count++;
$fp = fopen(COUNT_FILE, "w");
fputs($fp, $count , 10);
fclose($fp);
return $count;
}
$strCount = addCount();
$width = strlen($strCount) * ImageFontWidth(COUNT_FONT);
$hImg = ImageCreate($width, ImageFontHeight(COUNT_FONT));
list($red, $green, $blue) = ConvertColor($bgColor);
$clrBg = ImageColorAllocate($hImg, $red, $green, $blue);
list($red, $green, $blue) = ConvertColor($fgColor);
$clrFg = ImageColorAllocate($hImg, $red, $green, $blue);
ImageFill($hImg, 1, 1, $clrBg);
ImageString($hImg, COUNT_FONT, 1, 1, $strCount, $clrFg);
header("Content-type: image/gif");
ImageGIF($hImg);
ImageDestroy($hImg);
?>


[/php]



事例

提问者:meteor_shower   08-22 12:12
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
88 + 1 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM