错误:这里报出文件不存在。
思考过程:
1、我原以为是程序里没有这个文件呢,结果发现,文件是有的,那是怎么回事?
2、后来我再猜是不是php内核有问题,我把php的相关内核文件看了一遍,也没发现问题。结果我就把整个过程跟项目经理说去了。——事情也没解决,就这样先不了了之。升级的事情先耽误着。
今天又发现这个问题,我第一反应是php版本是不是升级了,发现没有。——后来把整个目录设置成777就没事了(chmod 777 -R 目录)。我想是不是file_exists()方法问题。
所以,我就进行了相关的调试和实验。
目录:
观察各个权限:test对www是没有任何权限的,而执行文件index.php有读写执行权限,包含文件test.txt有读写权限。
运行结果:
既然成功了,说明file_exists()函数是受目录权限的限制的。
那什么样的目录权限影响file_exists()呢?
我做了几个实验:
1、文件的任何上级目录,只有写权限时报文件不存在;
2、文件的任何上级目录,只有读权限时也报文件不存在;
3、而当所有上级目录都有执行权限的时候,报文件是存在的,一切都正常。
结果,说明file_exists()在判断文件是否存在的时候是递归判断每个目录是不是有执行权限。
修改文件路径为相对路径,得出一样的结果。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
