使用PHP gd时"无法找到/打开字体"

Dre*_*eur 6 php fonts gd

我在PHP中Could not find/open font尝试时遇到此错误imagettftext().

那里有字体文件.问题是什么?

Dre*_*eur 10

我找到了字节上的答案http://bytes.com/topic/php/answers/4833-gd-could-not-find-open-font-font-problem

设置gdfontpath可能会有所帮助

$fontpath = realpath('.'); //replace . with a different directory if needed
putenv('GDFONTPATH='.$fontpath);
$font = 't.otf';
...
$box = imagettfbbox($size, 0, $font, $text);
Run Code Online (Sandbox Code Playgroud)

  • 与此争吵太久了.天哪,谢谢你. (2认同)