本篇文章给大家分享的内容是用php代码写出❤️并自己定义文字,有着一定的参考价值,有需要的朋友可以参考一下
<?phpdate_default_timezone_set("PRC"); for ($t=0;$t<360;$t++) {
$y=2*cos($t)-cos(2*$t);
$x=2*sin($t)-sin(2*$t);
$x+=3;
$y+=3;
$x*=70;
$y*=70;
$x=round($x);
$y=round($y);
$str[]=$x;
$y=$y+2*(180-$y);
$x=$y;
$str[]=$x;
}
$im=imagecreate(400, 400);//创建画布400*400
$black=imagecolorallocate($im, 255, 255, 255);
$red=imagecolorallocate($im, 255, 0, 0);//设置颜色
imagepolygon($im, $str, 360, $red);
imagestring($im, 5, 130, 160, date("Y-m-d H:i:s"), $red);
imagestring($im, 5, 130, 190, "Content is missing ", $red);
imagestring($im, 5, 195, 220, "But ", $red);
imagestring($im, 5, 165, 250, "i love you ", $red);
$resultNamePath = './love.jpg';//图片保存地址
// $resultNamePath = dirname(dirname(dirname(dirname(__FILE__)))).DIRECTORY_SEPARATOR.'love.jpg';//图片保存地址
// print_r($resultNamePath);die;
imagegif($im, $resultNamePath);//输出图片
echo "<img src='$resultNamePath'/>";
相关推荐:
立即学习“PHP免费学习笔记(深入)”;
以上就是用php代码写出❤️并自己定义文字的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号