不同驱动器中文件的路径?

nav*_*and 4 php path relative-path absolute-path opendir

我的 php 文件在这里: D:/Appserv/www/x/y/file.php

我想从这个文件夹加载东西: E:/foldie

我不知道哪条路会带我到那里。

$somePath="HELP ME HERE!!!!"  
$dir=opendir($somePath);

//looping through filenames
while (false !== ($file = readdir($dir))) {
    echo "$file\n";
}
Run Code Online (Sandbox Code Playgroud)

Ale*_*kov 5

使用它应该工作的文件的完整 Windows 路径:“E:\folder\file.txt”

或者只是将文件复制到本地/项目目录中以进行测试。

  • 确保你在字符串中转义你的反斜杠(在保罗的帖子中提到) (2认同)