php imagettftext 无效黑屏
在网上学PHP课程,昨天学到imagettftext,代码与老师的一样,但就是黑屏,画布也不出现,只在屏幕中间出现一下白色的小方块。
在网上查了许多,没有特别明确的答案,但还是有差不多的。
我把字体文件改为了绝对路径,解决了。
// 字体文件绝对路径
$font = 'E:/phpstudy_pro/www/php7/senior2/image/3.ttf'
//绘制文字
imagettftext($image,20,10,50,100,$white,$font,"Hello world!");