我正在尝试使用一个函数来让它工作:
<img src='login.php?image=ind_legend.jpg'>
但是我无法通过函数来放置图像。我后退了几步,只尝试了这部分代码:
<?php
$file = "http://localhost/sales/test.jpg";
header('Content-type: image/jpeg');
readfile($file);
?>
或者使用这个函数:
echo file_get_contents($source);
但事实是,我得到的唯一结果是图像交叉 (IE) 损坏或在 Firefox 中什么都没有。
如果有任何建议,我将不胜感激
提前致谢
最佳答案
在readfile()
之前使用php的ob_clean()函数关于php - 带有 readfile 和 file_get_contents 的损坏图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5877138/