标题: 【讨论】用类和普通命令有区别诶~~~~
银色永逸
新生入学
Rank: 1
注册用户



UID 149865
精华 0
积分 0(积分有什么用?)
帖子 14
阅读权限 10
注册 2006-2-17
状态 离线
发表于 2006-2-28 16:56  资料  个人空间  短消息  加为好友 
【讨论】用类和普通命令有区别诶~~~~

用普通命令时屏显正常,但用‘类’就不行了,照道理都一样的嘛,拿出来大家讨论一下..................

<?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);



 附件: 您所在的用户组无法下载或查看附件
顶部
不容错过的IBM 集群技术资源汇总
 



当前时区 GMT+8, 现在时间是 2008-5-17 10:23

    Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.056993 second(s), 5 queries

清除 Cookies - 联系我们 - Linux伊甸园 - Archiver - WAP