> 백엔드 개발 > PHP 튜토리얼 > php只好在本地服务器网站跟目录创建目录吗?不能在其它盘创建吗

php只好在本地服务器网站跟目录创建目录吗?不能在其它盘创建吗

WBOY
풀어 주다: 2016-06-13 13:22:32
원래의
828명이 탐색했습니다.

php只能在本地服务器网站跟目录创建目录吗?不能在其它盘创建吗?

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php function copyDir($dirSrc,$dirTo){
        if(is_file($dirTo)){
            echo "目标不是目录不能创建";
            return ;
        }
        if(!file_exists($dirTo)){
            mkdir($dirTo);
        }
        
        if($dir_handle=@opendir($dirSrc)){
            while ($filename = readdir($dir_handle)){
                if($filename != "." && $filename != ".."){
                    $subSrcFile = $dirSrc."\\".$filename;
                    $subToFile = $dirTo."\\".$filename;
                    
                    if(is_dir($subSrcFile)){
                        copyDir($subSrcFile,$subToFile);
                    }
                    if(is_file($subSrcFile)){
                        copy($subSrcFile,$subToFile);
                    }
                }
            }
            closedir($dir_handle);
        }
    }
    copyDir("myphp","D:\\admin");
?>

로그인 후 복사


把盘符去了,就可以创建。不知道为什么不到copy到其它盘
加盘符就会出现错误
如:Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(D:\admin) is not within the allowed path(s): (E:\web) in E:\web\copyFile.php on line 3

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(D:\admin) is not within the allowed path(s): (E:\web) in E:\web\copyFile.php on line 7

Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(D:\admin) is not within the allowed path(s): (E:\web) in E:\web\copyFile.php on line 8

Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(D:\admin\file) is not within the allowed path(s): (E:\web) in E:\web\copyFile.php on line 3

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(D:\admin\file) is not within the allowed path(s): (E:\web) in E:\web\copyFile.php on line 7

Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(D:\admin\file) is not within the allowed path(s): (E:\web) in E:\web\copyFile.php on line 8

Warning: copy() [function.copy]: open_basedir restriction in effect. File(D:\admin\file\wo.txt) is not within the allowed path(s): (E:\web) in E:\web\copyFile.php on line 21

Warning: copy(D:\admin\file\wo.txt) [function.copy]: failed to open stream: Operation not permitted in E:\web\copyFile.php on line 21

Warning: copy() [function.copy]: open_basedir restriction in effect. File(D:\admin\in.txt) is not within the allowed path(s): (E:\web) in E:\web\copyFile.php on line 21

Warning: copy(D:\admin\in.txt) [function.copy]: failed to open stream: Operation not permitted in E:\web\copyFile.php on line 21


------解决方案--------------------
你这个是各种错,路径不对,权限不对,自己检查清楚.
你是虚拟主机?
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿