繁体   English   中英

标头(“ Content-Type:图片/ jpeg”)不起作用

[英]header(“Content-Type: image/jpeg”) not working

读完所有类似的问题后,没有任何情况比我更像。 删除所有废话之后,我的代码是:

<?php
$file = 'Images\Bird1.jpg';
header('Content-Type: image/jpeg');
imagejpeg($file);
?>

但它会显示空白页。 path \\ file确实存在,我使用以下代码检查了它:

if (file_exists($file))

文件类型的确是image / jpeg,我还在代码的更广泛版本中进行了检查。 请帮忙?

imagejpeg($file);

此功能需要资源,而不是文件名。 你在找

readfile($file);

http://php.net/manual/en/function.readfile.php

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM