php 情书,PHP好玩的代码一(笛卡尔的情书)
生活随笔
收集整理的这篇文章主要介绍了
php 情书,PHP好玩的代码一(笛卡尔的情书)
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
效果:
代码:
$width = 600; $height = 650; header("Content-type: image/gif"); $img = imagecreate($width, $height); $bg_color = imagecolorallocate($img, 0, 0, 0); $red = imagecolorallocate($img, 255, 0, 0); for ($i = 0; $i <= 100; $i++) { for ($j = 0; $j <= 100; $j++) { $r = M_PI / 50 * $i * (1 - sin(M_PI / 50 * $j)) * 40; $x = $r * cos(M_PI / 50 * $j) * sin(M_PI / 50 * $i) + $width / 2; $y = -$r * sin(M_PI / 50 * $j) + $height / 6; imagesetpixel($img, $x, $y, $red); } } imagegif($img); imagedestroy($img);exit;
总结
以上是生活随笔为你收集整理的php 情书,PHP好玩的代码一(笛卡尔的情书)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: centos 6.5配置php,Cent
- 下一篇: php大号字体代码,支持中文字母数字、自