【发布时间】:2018-07-04 23:45:28
【问题描述】:
我正在尝试显示来自 PHP 服务器的图像。 这是我的功能:
function get_file($path) {
$fileToGet = $GLOBALS['homedir'].$path;
//echo $fileToGet.PHP_EOL;
if (file_exists($fileToGet)) {
//echo 'file exists';
header('Content-Type: image/png');
header('Content-Length: '.filesize($fileToGet));
echo file_get_contents($file);
}
}
我正在使用浏览器或邮递员,图像无效。
我错过了什么?
【问题讨论】:
标签: php image apache server client