php输出下划线,使用php GD库输出带下划线文本的图像
用GD或任何其他庫顯示帶下劃線的文本并將結果輸出為圖像的最佳方法是什么?
解決方法:
您可以嘗試使用結合了字符U 0332的Unicode下劃線.
// 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);
?>
標簽:gd,php
來源: https://codeday.me/bug/20191210/2103346.html
總結
以上是生活随笔為你收集整理的php输出下划线,使用php GD库输出带下划线文本的图像的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 永泰能源10转7.88是什么意思
- 下一篇: 动态规划算法php,php算法学习之动态