<?php
    
    // 使用php操作gd库做图
    // 1. 创建一个画布资源
    $im = imagecreatetruecolor(80, 40);

    // 2. 画内容
    // 2.1 先位画布准备颜色
    $string_color = imagecolorallocate($im, 255, 255, 255);
    // 2.2 往画布上写入字符串
    imagestring($im, 5, 15, 14, 'hello', $string_color);

    // 3. 设置响应头
    header('Content-type:image/png');

    // 4. 输出图片
    //imagepng($im);
    imagepng($im, 'test.png');

    // 5. 释放资源
    imagedestroy($im);

?php>