【发布时间】:2017-03-27 17:29:25
【问题描述】:
这是我的代码:
<?php $filename = $var.'p_folder/'.sub_replace('?','',$page).'/images/default.png'; ?>
<img src = "<?php echo $filename; ?>"
title= "<?php echo file_exists($filename) ? 'exists' : 'not exist'; ?>"
>
我的代码也显示了图像,但 file_exists() 返回 false (我的意思是“不存在”打印).. 为什么?
其实这对我来说很奇怪..因为我可以在网络上看到图像,所以这意味着图像存在于目录中,但是为什么file_exists() 找不到呢?
【问题讨论】:
-
您是否尝试过不嵌入它,而是首先设置 $filename 并将该变量嵌入到
元素上?
-
你应该试试 " title="" >
-
file_exists检查文件路径而不是文件url
标签: php html function path directory