基本上,这个错误消息说明了一切:
file_get_contents(./users.txt): failed to open stream: No such file or directory in C:\XAMPP\htdocs\login.php
这段代码会抛出以下错误:
$ru = file_get_contents("./users.txt");
我要访问的文件是users.txt。PHP似乎正在通过自身搜索此文件。我尝试了很多东西,包括使用绝对路径,但都没有用。它总是搜索我放在括号里的任何东西。
发布于 2018-06-28 04:16:00
file_get_contents
使用string
参数作为文件名。
尝试更改file_get_contents(./users.txt)
至
file_get_contents('./users.txt')
。
编辑:
在评论中讨论之后,还要确保检查您的文件没有命名错误。即users.txt.txt
。
https://stackoverflow.com/questions/51070713
复制相似问题