<code><?php class shape { var $x,$y,$r; function add($x,$y,$r) { $image=imagecreate(500,300); $background=imagecolorallocate($image,255, 255,255); $red=imagecolorallocate($image,255,0, 0); imagearc($image, $x, $y, $r, $r, 0,360,$red); header("Content-type:image/gif"); imagegif($image); $obj->x='100'; $obj->y='100'; $obj->r='50'; echo $obj->x, $obj->y, $obj->r; } } $obj=new shape; ?></code>
<code><?php class shape { var $x,$y,$r; function add($x,$y,$r) { $image=imagecreate(500,300); $background=imagecolorallocate($image,255, 255,255); $red=imagecolorallocate($image,255,0, 0); imagearc($image, $x, $y, $r, $r, 0,360,$red); header("Content-type:image/gif"); imagegif($image); $obj->x='100'; $obj->y='100'; $obj->r='50'; echo $obj->x, $obj->y, $obj->r; } } $obj=new shape; ?></code>
我运行了,是可以的,只不过你的代码写得让我很蛋痛
实例化后要调用方法呀
我猜你是因为缺少了GD库
导致的,去安装一下吧