【发布时间】:2021-02-11 21:06:25
【问题描述】:
如您所见,我已经安装了 GD 库。(图片) 但是当我尝试创建图像时,它会显示特殊字符而不是图像。(图像) 我正在使用 laravel 和 Xampp。
有人知道是什么问题吗?
<?php
// create a blank image
$image = imagecreatetruecolor(400, 300);
// fill the background color
$bg = imagecolorallocate($image, 0, 0, 0);
// choose a color for the ellipse
$col_ellipse = imagecolorallocate($image, 255, 255, 255);
// draw the white ellipse
imagefilledellipse($image, 200, 150, 300, 200, $col_ellipse);
// output the picture
header("Content-type: image/png");
imagepng($image); ?>
【问题讨论】:
-
输出(在图像中)看起来像
var_dump,而不是该脚本的输出。 (那些“特殊字符”是你的形象) -
我知道那是我的形象,但为什么会这样显示?它必须是 laravel 的东西,因为我已经在一个干净的 index.php 上进行了测试并且可以工作,但是在 laravel 视图中它不起作用