PHP is_dir() returns false on Windows network drive

前端 未结 1 1905
后悔当初
后悔当初 2021-01-18 03:51

I have a network drive mapped to drive letter X:\\ going to an external hard drive with the path of \"\\\\X-Drive\\Public\\Data\".

I am using Zend Server with Apac

1条回答
  •  天命终不由人
    2021-01-18 04:24

    For network shares you should use UNC names: "//server/share/dir/file.ext" Source

    If you use the IP or hostname it should work fine:

    $isFolder = is_dir("\\\\NAS\\Main Disk");
    var_dump($isFolder); //TRUE
    
    $isFolder = is_dir("//NAS/Main Disk");
    var_dump($isFolder); //TRUE
    
    $isFolder = is_dir("N:/Main Disk");
    var_dump($isFolder); //FALSE
    

    0 讨论(0)
提交回复
热议问题