1

我很难过,我敢肯定我在这里遗漏了一些非常基本的东西。安全模式被禁用,文件存在。

这段代码:

$dir = "textfiles"
chdir('../'.$dir."/");
  //using a Windows Slash here(Wamp Stack, on Windows 7 Dev environment

$filename = getcwd() ."\\". $row[0];

       //echoing this outputs: 
       //C:\wamp\www\wordpress\textfiles\New Text Document.txt


$filename = str_replace("\\","\\\\",$filename);

      //echoing this outputs C:\\wamp\\www\\wordpress\\textfiles\\New Text Document.txt
      //escaping slashes in filename to prevent escaping. I SUSPECT my issue may be
      // related to this

    //if (file_exists("C:\\wamp\\www\\wordpress\\textfiles\\New Text Document.txt")) {
            //Line above is commented out, but when it replaces the line below, this thing                       
            //returns True


if (file_exists($filename)) {echo "Yes";} 
   else { echo $filename;}
4

1 回答 1

0

注释掉一行

/* $filename = str_replace("\\","\\\\",$filename); */

你的代码应该可以工作。

于 2013-01-05T15:09:19.427 回答