PHP 如何判断映射目录是否存在?
如果存在,如何获得此目录的大小和修改时间
 
目录为(\\apguds\note\x-section\05C62\) 开始运行中可直接打开
不知道PHP中代码对于这个路径是要怎么写的,试了半天没成功 

解决方案 »

  1.   

    你这个映射目录是否需要密码访问?<?php// Define the parameters for the shell command
    $location = "\\servername\sharename";
    $user = "USERNAME";
    $pass = "PASSWORD";
    $letter = "Z";// Map the drive
    system("net use ".$letter.": \"".$location."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1");$dir = $letter.":/";// Check the directory
    if(is_dir($dir) && is_readable($dir)) {
        // 获取目录大小
    }
      

  2.   

    那你就这样用好了
    <?php
     
    // Define the parameters for the shell command
    $location = "\\servername\sharename";
    $letter = "Z";
     
    // Map the drive
    system("net use ".$letter.": \"".$location."\" /persistent:no>nul 2>&1");
     
    $dir = $letter.":/";
     
    // Check the directory
    if(is_dir($dir) && is_readable($dir)) {
        // 获取目录大小
    }
      

  3.   

    还是没有用,你这个是要创建一个映射盘? 我电脑好像没这个(运行后也没有创建个个),我是直接在运行输入后就可以打开的
    <?php
    // Define the parameters for the shell command
    $location = "\\apguds02\mi_note\x-section\04c692";
    $letter = "Z";
     // Map the drive
    system("net use ".$letter.": \"".$location."\" /persistent:no>nul 2>&1");
     
    $dir = $letter.":/";
     
    // Check the directory
    if(is_dir($dir) && is_readable($dir)) {
        echo '目录存在';
    }
    else{
      echo '目录不存在';
    }
    ?>这个目录是存在的,可是输出是不存在, 另外存在的时候如何获得大小和日期啊