Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php-在浏览器中显示png/image在localhost中工作,但在aws上不工作_Php_Laravel - Fatal编程技术网

php-在浏览器中显示png/image在localhost中工作,但在aws上不工作

php-在浏览器中显示png/image在localhost中工作,但在aws上不工作,php,laravel,Php,Laravel,我正在使用此代码在uuser web浏览器上输出一个文件 header("Content-Type: image/png"); header("Content-Disposition: inline; filename=".$file_name.".png;"); echo file_get_contents('data:image/png;base64,'. $file_content); 这在我的本地主机docker环境中运行良好

我正在使用此代码在uuser web浏览器上输出一个文件

header("Content-Type: image/png");
header("Content-Disposition: inline; filename=".$file_name.".png;");
echo file_get_contents('data:image/png;base64,'. $file_content);
这在我的本地主机docker环境中运行良好,但在EC2中它显示奇怪的字符(如下图所示)


我做错什么了吗?

试着这样做:

<img src='data:image/png;base64,<?php echo base64_encode(file_get_contents($file_name.".png")); ?>'>
”>

内联
更改为
附件
可以下载文件并工作,但我的目标是在浏览器中显示文件