php输出下划线,使用php GD库输出带下划线文本的图像
用GD或任何其他庫(kù)顯示帶下劃線(xiàn)的文本并將結(jié)果輸出為圖像的最佳方法是什么?
解決方法:
您可以嘗試使用結(jié)合了字符U 0332的Unicode下劃線(xiàn).
// Set the content-type
header('Content-type: image/png');
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = "?U?d?e?r?l?i?n?e";
// Replace path by your own font path
$font = 'arial.ttf';
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
標(biāo)簽:gd,php
來(lái)源: https://codeday.me/bug/20191210/2103346.html
總結(jié)
以上是生活随笔為你收集整理的php输出下划线,使用php GD库输出带下划线文本的图像的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 永泰能源10转7.88是什么意思
- 下一篇: php json和数组,php数组和js