简体   繁体   English

无法使用php创建文件夹

[英]Cannot creating folders with php

i used the manual from php.net but i cannot get it to work. 我使用了来自php.net的手册,但无法正常使用。 Don't see what i am doing wrong. 不要看我在做什么错。 I get this error message when i try to do 我尝试执行此操作时收到此错误消息

Warning: ftp_mkdir(): Can't create directory: No such file or directory in /home/user/public_html/management/test.php on line 11
There was a problem while creating /home/user/public_html/images/screenshots/wiiu/alien_isolation/ 

below is the code i use... 以下是我使用的代码...

        <?php

        $ftp_user_name = "user";
        $ftp_user_pass = "password";
        $ftp_server = "www.site.com";
        $gamename = "alien_isolation";
        $path = "/home/user/public_html/images/screenshots/wiiu/" . $gamename . "/";
        $conn_id = ftp_connect($ftp_server);
        $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

        if (ftp_mkdir($conn_id, $path)) {
         echo "successfully created $path\n";
        } else {
         echo "There was a problem while creating $path\n";
        } 

        ftp_close($conn_id); 

        ?>

edit: my php handler is set to DSO and now it works 编辑:我的PHP处理程序设置为DSO,现在可以使用

Are you sure that the path 你确定那条路吗

/home/user/public_html/images/screenshots/wiiu/

exists? 存在吗?

将php处理程序设置为DSO,即可使用

**Use this** 

<?php
        $ftp_user_name = "user";
        $ftp_user_pass = "password";
        $ftp_server = "www.site.com";
        $gamename = "alien_isolation";
        $path = "/home/user/public_html/images/screenshots/wiiu/";
        $conn_id = ftp_connect($ftp_server);
        $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
        @ftp_chdir($conn_id, $path);
        if (ftp_mkdir($conn_id, $gamename)) {
         echo "successfully created $path\n";
        } else {
         echo "There was a problem while creating $path\n";
        } 

        ftp_close($conn_id); 

        ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM