取决于PHP使用的GD库版本,如果fontfile不是以前导/开头,则.ttf将附加到文件名,并且库将尝试沿着库定义的字体路径搜索该文件名. Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.这似乎暗示着fontfile应该是绝对路径,如果不是,则该函数将在其末尾附加另一个.ttf.This seems to imply that the fontfile should be an absolute path, and if it isn't, the function will append another .ttf onto the end of it.指定字体文件的完整路径.Specify the full path to the font file.$font = "/home/a2424901/public_html/Arial.ttf";或省略.ttf并使用GDFONTPATH. 文档建议以下内容:Or omit the .ttf and use the GDFONTPATH. The documentation recommends the following: 在许多情况下,字体与使用该脚本的脚本位于同一目录中,以下技巧可减轻任何包含问题. In many cases where a font resides in the same directory as the script using it the following trick will alleviate any include problems.putenv('GDFONTPATH=' . realpath('.'));$font = "Arial"; 这篇关于警告:imagettftext()[function.imagettftext]:在第35行的/home/a2424901/public_html/index.php中找不到/打开字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-28 12:31
查看更多