php-在浏览器中显示png/image在localhost中工作,但在aws上不工作
我正在使用此代码在uuser web浏览器上输出一个文件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环境中运行良好
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")); ?>'>
”>
将内联
更改为附件
可以下载文件并工作,但我的目标是在浏览器中显示文件