Home >Backend Development >PHP Tutorial >Write ❤️ in php code and define the text yourself
The content shared with you in this article is written using php code ❤️ and defining the text yourself. It has a certain reference value. Friends in need can refer to it
<?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'/ alt="Write ❤️ in php code and define the text yourself" >";
Related recommendations:
PHP for sending SMS emails and many other practical PHP code sharing
Use PHP code to generate images on web pages_PHP tutorial
The above is the detailed content of Write ❤️ in php code and define the text yourself. For more information, please follow other related articles on the PHP Chinese website!