判断文件或目录是否存在函数问题请教

WBOY
Release: 2016-06-06 20:06:40
Original
845 people have browsed it

PHP中的判断文件或者目录是否存在的函数
举个例子:file_exists,用这个函数去判断服务器地址中的文件,明明文件存在,路径也没错,但总是返回FALSE,还有我用fopen也打不开对应路径中的文件,请问这个是怎么回事?希望能列举出出现这种情况的多种可能性和解决办法?

回复内容:

PHP中的判断文件或者目录是否存在的函数
举个例子:file_exists,用这个函数去判断服务器地址中的文件,明明文件存在,路径也没错,但总是返回FALSE,还有我用fopen也打不开对应路径中的文件,请问这个是怎么回事?希望能列举出出现这种情况的多种可能性和解决办法?

出现这种情况原因主要是你的文件路径没写对,也可能是文件所在目录没有授予PHP运行用户读取的权限。另外,你说的去读取服务器地址中文件file_exists只能操作本地文件,对远程文件不能操作。

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!