【发布时间】:2018-12-20 23:06:18
【问题描述】:
我在 php 上有这段代码:
while (!file_exists(test.txt)) sleep(1); //wait for test.txt (in the same path)
header("Location:loading.php"); //proceed with the next page
但它不起作用。
即使文件正确生成,它也会保持循环。
我只希望他找到文件后,继续使用标题,但直到那时才继续。
谢谢。
【问题讨论】:
-
也许你忘记了引号?
file_exists('test.txt') -
您可能还需要提供完整的路径名。
-
你在这里的可怕代码;)
-
经过测试,但问题仍然存在。谢谢。
-
您需要提供与执行此代码的 php 相关的完整文件路径。否则任何人都在猜测。
标签: php while-loop header file-exists