[英]header(“Content-Type: image/jpeg”) not working
Having read through all the similar questions, no situation is like mine. 读完所有类似的问题后,没有任何情况比我更像。 After cutting all the crap, my code is:
删除所有废话之后,我的代码是:
<?php
$file = 'Images\Bird1.jpg';
header('Content-Type: image/jpeg');
imagejpeg($file);
?>
But it dispays a blank page. 但它会显示空白页。 The path\\file does exist, I checked it with code like:
path \\ file确实存在,我使用以下代码检查了它:
if (file_exists($file))
The file type is indeed image/jpeg, this I also checked in the more extensive version of my code. 文件类型的确是image / jpeg,我还在代码的更广泛版本中进行了检查。 Please help?
请帮忙?
imagejpeg($file);
This function requires a resource, not a filename. 此功能需要资源,而不是文件名。 You are looking for
你在找
readfile($file);
http://php.net/manual/en/function.readfile.php http://php.net/manual/en/function.readfile.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.