0
我要检查图像是否存在:检查图像是否
<?php
if(file_exists($this->baseUrl('upload/'.$this->lmObject->getLImage())) echo "EXIST";
else echo "NOT FOUND";
?>
<img src="<?php echo $this->baseUrl('upload/'.$this->lmObject->getLImage())?>" width="150" height="150" >
产量为:NOT FOUND,而图像显示以及..奇怪吧?我在这里错了什么?
+1为了澄清[PHP HTTP包装(http://www.php.net/manual/en/wrappers.http.php)不支持'stat()'这就是为什么askers代码不起作用。有关更多信息,请参见[file_exists](http://php.net/manual/en/function.file-exists.php)文档。 – Treffynnon