首页 > 解决方案 > 调用未定义函数 imagettftext()

问题描述

我没有使用 PHP 的经验,但我试图在我的 macOS Sierra High 10.13.2 上运行一个 php 文件。我收到此错误:

Call to undefined function imagettftext()

我安装了 GD 和 Freetype。问题是什么?

for ( $i = 0; $i < strlen( $word ); $i++ ) {
            $font = $this->fonts[array_rand( $this->fonts )];
            $font = $this->normalize_path( $font );

            imagettftext( $im, $this->font_size, mt_rand( -12, 12 ), $x,
                $this->base[1] + mt_rand( -2, 2 ), $fg, $font, $word[$i] );
            $x += $this->font_char_width;
        }

标签: phpgdfreetype

解决方案


推荐阅读