(PHP 4, PHP 5, PHP 7, PHP 8)
imagechar — 水平地畫一個字符
$image,$font,$x,$y,$c,$color
imagechar() 將字符串
c 的第一個字符畫在
image 指定的圖像中,其左上角位于
x,y(圖像左上角為 0,
0),顏色為 color。如果 font
是 1,2,3,4 或 5,則使用內(nèi)置的字體(更大的數(shù)字對應(yīng)于更大的字體)。
示例 #1 imagechar() 例子
<?php
$im = imagecreate(100,100);
$string = 'PHP';
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// prints a black "P" in the top left corner
imagechar($im, 1, 0, 0, $string, $black);
header('Content-type: image/png');
imagepng($im);
?>
參見 imagecharup() 和 imageloadfont()。