php echo "<img src=".$file." >" ; 不显示图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6689272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
echo "<img src=".$file." >" ; doesn't display image
提问by Pradeep Kumar
echo "<img src=".$file." >" ;
does not display image, while $file points to the correct image location C:\wamp\www\formulae\public\images\13.png
不显示图像,而 $file 指向正确的图像位置 C:\wamp\www\formulae\public\images\13.png
part of code reads as follows
部分代码如下
$file = LIBPATH.DS.'images'.DS.$id.'.png' ;
if(file_exists($file)){
echo $file."</br>";
echo "<img src='".$file."' >" ;
}
回答by Cin Sb Sangpi
<img src="<?php echo file_dir . '/' . $imageone; ?>" height="100" width="100"/>
would help you
会帮助你
回答by Fabrizio D'Ammassa
You should use paths relative to your Apache document root and not absolute to your file system.
您应该使用相对于 Apache 文档根目录的路径,而不是相对于文件系统的绝对路径。
回答by Nitish
Try this
尝试这个
echo '<img src="'.$file.'">';