ホームページ バックエンド開発 PHPチュートリアル PHP はローカルサーバーの Web サイトとディレクトリにディレクトリを作成する必要がありますか?別のディスクに作成できないのでしょうか?

PHP はローカルサーバーの Web サイトとディレクトリにディレクトリを作成する必要がありますか?別のディスクに作成できないのでしょうか?

Jun 13, 2016 pm 01:22 PM
file function quot web

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

PHP code
<!--

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

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

ログイン後にコピー


把盘符去了,就可以创建。不知道为什么不到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


------解决方案--------------------
你这个是各种错,路径不对,权限不对,自己检查清楚.
你是虚拟主机?
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットな記事タグ

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

紅夢ネイティブアプリケーションのランダムな詩 紅夢ネイティブアプリケーションのランダムな詩 Feb 19, 2024 pm 01:36 PM

紅夢ネイティブアプリケーションのランダムな詩

JavaのFile.length()関数を使用してファイルのサイズを取得します。 JavaのFile.length()関数を使用してファイルのサイズを取得します。 Jul 24, 2023 am 08:36 AM

JavaのFile.length()関数を使用してファイルのサイズを取得します。

機能とはどういう意味ですか? 機能とはどういう意味ですか? Aug 04, 2023 am 10:33 AM

機能とはどういう意味ですか?

JavaのFile.renameTo()関数を使用してファイルの名前を変更する JavaのFile.renameTo()関数を使用してファイルの名前を変更する Jul 25, 2023 pm 03:45 PM

JavaのFile.renameTo()関数を使用してファイルの名前を変更する

JavaのFile.getParentFile()関数を使用してファイルの親ディレクトリを取得します。 JavaのFile.getParentFile()関数を使用してファイルの親ディレクトリを取得します。 Jul 27, 2023 am 11:45 AM

JavaのFile.getParentFile()関数を使用してファイルの親ディレクトリを取得します。

Java API開発におけるWebサーバー処理にJetty7を使用する Java API開発におけるWebサーバー処理にJetty7を使用する Jun 18, 2023 am 10:42 AM

Java API開発におけるWebサーバー処理にJetty7を使用する

Golang を使用して Web アプリケーションのフォーム検証を実装する方法 Golang を使用して Web アプリケーションのフォーム検証を実装する方法 Jun 24, 2023 am 09:08 AM

Golang を使用して Web アプリケーションのフォーム検証を実装する方法

JavaのFile.getParent()関数を使用してファイルの親パスを取得します。 JavaのFile.getParent()関数を使用してファイルの親パスを取得します。 Jul 24, 2023 pm 01:40 PM

JavaのFile.getParent()関数を使用してファイルの親パスを取得します。

See all articles