【讨论】用类和普通命令有区别诶~~~~
用普通命令时屏显正常,但用‘类’就不行了,照道理都一样的嘛,拿出来大家讨论一下..................
<?php
Header("Content-type: image/png");
$im_width = 600 ;
$im_hight = 240 ;
$im_leftwidth = 45 ;
$im_rightwidth = 18 ;
$im_tophight = 20 ;
$im_underhight = 38 ;
$sim_border = 3 ; //突出的部分长度
$im = Imagecreatetruecolor ($im_width,$im_hight);
$col_background = ImageColorAllocate($im,0,0,0);
$col_backgird = ImageColorAllocate($im,53,53,53);
$col_xybase = ImageColorAllocate($im,109,109,109);
$col_red = ImageColorAllocate($im,255,0,0);
$col_blue = ImageColorAllocate($im,51,204,51);
$col_font = ImageColorAllocate($im,116,116,116);
$col_trans = ImageColorAllocate($im,67,68,69);
//===================================================
// BACK_ground_COLOR
// Description: background to the picture
//===================================================
Imagefilledrectangle($im,$im_leftwidth,$im_tophight,$im_width-$im_tophight,$im_hight-$im_underhight-1,$col_backgird);
Imagefilledrectangle($im,420,29.1,560,63,$col_trans);
for( $y = $im_tophight ; $y <= $im_hight-$im_underhight-18.2 ; $y+=18.2 ){
ImageLine($im,$im_leftwidth-$sim_border,$y,$im_width-$im_rightwidth-2,$y,$col_xybase);
}
?>
若是把其中‘$col_background ’――‘$col_trans’的定义部分换成如下,:confused: 执行就不对了.....
Class ImageColor {
function ColorSet($vername,$color_r,$color_g,$color_b) {
$this->$vername = ImageColorAllocate($im,$color_r,$color_g,$color_b);
}
}
$color = new ImageColor ;
$color->Colorset($col_background,0,0,0);
$color->Colorset($col_backgird,53,53,53);
$color->Colorset($col_xybase,109,109,109);
$color->Colorset($col_red,255,0,0);
$color->Colorset($col_blue,51,204,51);
$color->Colorset($col_font,116,116,116);
$color->Colorset($col_trans,67,68,69);
附件: 您所在的用户组无法下载或查看附件
|