纯php实现中秋博饼游戏(1):绘制骰子图案
发布时间:2020-12-13 21:21:43 所属栏目:PHP教程 来源:网络整理
导读:最近公司中秋博饼(在厦门),自己没事也想玩玩,所以就想动手写了一个纯php实现的中秋博饼游戏,既然要纯php实现,就要用php来生成图案,所以第一步就先绘制骰子图案。 平时很少使用php绘图,不过查查资料还是绘制出来了,不多说了,代码如下: 1 header ('
最近公司中秋博饼(在厦门),自己没事也想玩玩,所以就想动手写了一个纯php实现的中秋博饼游戏,既然要纯php实现,就要用php来生成图案,所以第一步就先绘制骰子图案。 平时很少使用php绘图,不过查查资料还是绘制出来了,不多说了,代码如下: 1 header('Content-Type:image/png'); 2 $img = imagecreatetruecolor(200,200 3 $white = imagecolorallocate($img,255,255 4 $grey = imagecolorallocate( 5 $blue = imagecolorallocate( 6 $red = imagecolorallocate( 7 imagefill($white 8 imageline($grey 9 imageline(10 imageline(11 imageline(12 imageline(13 imageline(14 imageline(15 imageline(16 17 //1 18 imagefilledarc($blue, IMG_ARC_PIE); 19 2 20 //imagefilledarc($img,60,40,$red,IMG_ARC_PIE); 21 22 //3 23 24 25 26 //4 27 28 29 30 31 //5 32 33 34 35 36 37 //6 38 39 40 41 42 43 44 45 imagepng($img46 imagedestroy($img); ? 可以绘制出1-6点各点图案,1/3/5颜色是蓝色,2/4/6是红色,效果图如下: 纯php实现中秋博饼游戏系列博文: 纯php实现中秋博饼游戏(1):绘制骰子图案 ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |