扫码关注官方订阅号
我用php生成了一些图片(没有后缀,其实是PNG文件)
用URL读取的时候提示我下载而非直接显示图片(通过标签加载正常),请问我要怎么设置才能直接显示图片,而非下载。
人生最曼妙的风景,竟是内心的淡定与从容!
nginx add_header。
location /images/ { add_header content-type "image/png"; }
有个叫 ngxheadersmore 的nginx扩展,可以修改response header 把你图片请求的response,改成响应的Content-Type
location /png { moresetheaders 'Content-Type: image/png'; }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
nginx add_header。
有个叫 ngxheadersmore 的nginx扩展,可以修改response header 把你图片请求的response,改成响应的Content-Type
location /png { moresetheaders 'Content-Type: image/png'; }