Path to a file in a different drive?

a 夏天 提交于 2019-12-12 13:59:20

问题


My php file is here: D:/Appserv/www/x/y/file.php

I want to load stuff from this folder: E:/foldie

I don't know what path will lead me there.

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

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

回答1:


Use full Windows path to the file it should be working: "E:\folder\file.txt"

or just copy the file in the local/project directory for testing purpose.




回答2:


Set $somePath = "e:\\foldie". If that doesn't work, please indicate to us how it fails.

[Edit:: make sure you escape your backslashes in strings]



来源:https://stackoverflow.com/questions/6628863/path-to-a-file-in-a-different-drive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!