在PHP中,我们可以使用GD库来生成图像,并通过`imagestring()`或`imagestroke()`函数来在图像上画线。下面是一个简单的实例,展示如何使用PHP在图像上画不同粗细的线。

确保你的服务器已经安装了GD库。

以下是具体的代码实例:

```php

// 创建一个新的图像资源

$image = imagecreatetruecolor(200, 50);

// 分配颜色

$black = imagecolorallocate($image, 0, 0, 0);

$white = imagecolorallocate($image, 255, 255, 255);

// 填充背景

imagefill($image, 0, 0, $white);

// 画不同粗细的线

imagestring($image, 5, 10, 10, "