PHP imagechar - 寫出橫向字元
imagechar — 寫出橫向的字元。
語法
bool imagechar ( resource $image , int $font , int $x , int $y , string $c , int $color )
imagechar() 將字串 c 的第一個字元畫在 image 指定的圖像中,其左上角位於 x,y(圖像左上角為 0, 0),顏色為 color。如果 font 是 1,2,3,4 或 5,則使用內置的字體(更大的數字對應於更大的字體)。
實例
<?php $im = imagecreate(100,100); $string = 'PHP'; $bg = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); // 左上角輸出字元 P imagechar($im, 5, 0, 0, $string, $black); header('Content-type: image/png'); imagepng($im); ?>
以上實例輸出結果的圖片如下:
