例子2 ?php // Create the size of the image or blank image $img = imagecreate(700, 300); // Set the background color of the image $background_color = imagecolorallocate($img, 122, 122, 122); // Set the text color of the image $text_color =
<?php
// Create the size of the image or blank image
$img = imagecreate(700, 300);
// Set the background color of the image
$background_color = imagecolorallocate($img, 122, 122, 122);
// Set the text color of the image
$text_color = imagecolorallocate($img, 255, 255, 0);
// Function to create an image that contains a string.
imagestring($img, 10, 30, 60,"Tutorialspoint:Simply Easy Learning", $text_color);
header("Content-Type: image/png");
imagepng($img);
imagedestroy($img);
?>输出
