file_exists()使用绝对地址参数的问题

bool file_exists ( string $filename )

当$filename参数为’/path/to/foo.txt’之类的绝对路径的参数时, 实际上是指在当前盘符根目录下是否存在$filename, 而不是一般所认为的网站根目录.
写成 $_SERVER["DOCUMENT_ROOT"] . $filename就可以解决这个问题…

你可能感兴趣的:(file_exists()使用绝对地址参数的问题)