我正在使用 PHP imagejpeg 创建一个像这样的简单图像..
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
// Set the content type header - in this case image/jpeg
header('Content-Type: image/jpeg');
// Output the image
imagejpeg($im);
// Free up memory
imagedestroy($im);
这是有效的,但我希望它自动触发浏览器内的下载而不是显示图像。
我该怎么做,我需要设置标题吗?