我在这个目录下面有
D:/php/easyphp/www/dxsvn/data/app/images/1201/2.jpg
这一张图片,我需要移动到D盘并改名字为。
D:/A.jpg请问这怎么实现。

解决方案 »

  1.   

    rename('D:/php/easyphp/www/dxsvn/data/app/images/1201/2.jpg', 'D:/A.jpg');注意:需要有 D:\ 的写权限,且 D:/A.jpg 不存在
      

  2.   

    $fileName="D:/A.jpg";
    if(file_exitst($fileName))
      unlink($fileName);
    $srcName="D:/php/easyphp/www/dxsvn/data/app/images/1201/2.jpg";
    if(file_exitst($srcName))
      rename($srcName,$fileName);
    else
      die("源文件不存在!!~~~");
      

  3.   

    $fileName="D:/A.jpg";
    if(file_exists($fileName))
      unlink($fileName);
    $srcName="D:/php/easyphp/www/dxsvn/data/app/images/1201/2.jpg";
    if(file_exists($srcName))
      rename($srcName,$fileName);
    else
      die("源文件不存在!!~~~");