file_exists($filename)中文件路徑的問題??? 你放file_exists($filename)语句的那PHP文件与 Digithermo_2.jpg 的路经关系是... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $filename="/htdocs/image/bathroom_scales/Product/Thermometers/Digithermo_2.jpg"应该没问题也可换成$filename="//htdocs//image//bathroom_scales//Product//Thermometers//Digithermo_2.jpg" 放file_exists($filename)语句的那PHP文件与 Digithermo_2.jpg 的路经关系是...是這樣:是它父的父下的image/bathroom_scales/Product/Thermometers/Digithermo_2.jpg 这样把,假设文件文件1: php/1.php文件2: image/1.jpg在1.php中用$filename="../image/1.jpg";file_exists($filename); 这样写没有任何问题 file_exists($filename)你也可写作 file_exists(realpath($filename)) 这样写没有任何问题 file_exists($filename)你也可写作 file_exists(realpath($filename)) to xuzuning(唠叨)realpath("../image/1.jpg")realpath("../../image/1.jpg")這兩個返回的值是一樣的!!! 不会的设c:/program files/apache group/apache/htdocs/image/bathroom_scales/Product/Thermometersc:/program files/apache group/apache/htdocs/main/test.php在test.php中realpath("../image/1.jpg") 为c:/program files/apache group/apache/htdocs/image/1.jpgrealpath("../../image/1.jpg") 为c:/program files/apache group/apache/image/1.jpg a.html 文件 b.php 文件 c.jpg文件在 a.html 中用 b.php 下載 c.jpgc:\aa\bb1\cc1\dd\ee\a.htmlc:\aa\bb2\cc2\b.phpc:\aa\bb1\cc1\image\bathroom_scales\Product\Thermometers\c.jpgc:\aa 為 web 根目錄a.html<a href=\bb\cc\b.php?filename=../../../image\bathroom_scales\Product\Thermometers\c.jpg>test download</a>我用的是與 a.html 的相對路徑, 是不是不對? 應用 b.php的相對路徑? 这样把,假设文件 d:/web/ 能运行PHP放一个文件(1.jpg)在这目录下,也就是 d:/web/1.jpg在写个php页面(1.php),内容就是if (file_exists("1.jpg")){ echo "有";}else{ echo "没有";}然后你用ie运行1.php看看.如果还没有结果,我就没有办法了.本人能力也就这样了. $filename="你的文件的绝对路径"如果用绝对路径的话使没有问题的!如果用想对路径的话,起始点是这个网页源代码所在地的路径"../"是指上一级目录!在php的文件系统函数中都是这样的(包括file_exists) 跪求,网站编码问题 谁参加过康盛产品工程师的培训? php 引入数据操作 出错 为什么我加载IIS扩展, 网站就打不开呢? PHP官方手册,哪有下载? php如何判断一字符串中除了汉字和分号之外,不能有其他字符出现?该怎么样实现?? 怎样用js实现后台打开网页? 能不能用PHP读写Mr350卡机,高手们请看看!不够再加分!!! php中怎么样下载整个文件夹 PHP有关下拉列表的问题。 哪里有关于开发论坛或者聊天室的详细说明过程? 检查域名是否被注册的代码有没有?asp&php都可以,在线等待。
应该没问题
也可换成
$filename="//htdocs//image//bathroom_scales//Product//Thermometers//Digithermo_2.jpg"
文件1: php/1.php
文件2: image/1.jpg在1.php中用$filename="../image/1.jpg";
file_exists($filename);
你也可写作 file_exists(realpath($filename))
你也可写作 file_exists(realpath($filename))
realpath("../../image/1.jpg")這兩個返回的值是一樣的!!!
设
c:/program files/apache group/apache/htdocs/image/bathroom_scales/Product/Thermometers
c:/program files/apache group/apache/htdocs/main/test.php在test.php中
realpath("../image/1.jpg")
为c:/program files/apache group/apache/htdocs/image/1.jpg
realpath("../../image/1.jpg")
为c:/program files/apache group/apache/image/1.jpg
在 a.html 中用 b.php 下載 c.jpgc:\aa\bb1\cc1\dd\ee\a.htmlc:\aa\bb2\cc2\b.phpc:\aa\bb1\cc1\image\bathroom_scales\Product\Thermometers\c.jpgc:\aa 為 web 根目錄a.html
<a href=\bb\cc\b.php?filename=../../../image\bathroom_scales\Product\Thermometers\c.jpg>test download</a>我用的是與 a.html 的相對路徑, 是不是不對? 應用 b.php
的相對路徑?
echo "有";
}else{
echo "没有";
}然后你用ie运行1.php看看.如果还没有结果,我就没有办法了.本人能力也就这样了.
如果用绝对路径的话使没有问题的!
如果用想对路径的话,起始点是这个网页源代码所在地的路径
"../"是指上一级目录!
在php的文件系统函数中都是这样的(包括file_exists)