Android App无法在服务器上创建目录

时间:2016-05-09 07:32:13

标签: php android rest

我有一个应用程序,应该通过URL在服务器上创建一个目录。当我将该URL输入Web浏览器时,它可以正常工作。但是当我通过我的应用程序注册时,没有任何内容我已尝试使用另一个文件服务器,它工作。我的文件有777权限,手机端仍然没有。请帮忙

这是我的php代码

$gcmRegID  = $_POST["regID"]; 
            $gcmUserName  = $_POST["userName"]; 
            $gcmFolderName = $_POST["folderName"];

            $gcmDate = date("d/m/y");

            $conn = new mysqli($servername, $username, $password, $dbname);
            if($conn->connect_error){
                die("Connection failed: " . $conn->connect_error);
            }
            $in_user = "user";
            $in_password = "NULL";
            $in_email = "NULL";
            $in_dob = "NULL";
            $in_role = "user";
            $in_datejoined = "0000-00-00";

            $sql = "INSERT INTO user(password,regid,name,email,phone,dob,role,datejoined) VALUES('$in_password','$gcmRegID','$gcmUserName','$in_email','$in_phone','$in_dob','$in_role','$gcmDate')";

            //$gcmtest = "APA91bHUYXD_X2meMxOJ4JkWGyJVwv0Hy6UPvZ-5i42jLDoU3ofdEutPJspCuNDrxg-VutIHtfvDc8WSTziMxIwIh4YIZYzQiORoGG8VcV9R8azPTEXzRUkBMiKvGHXpOBJINljZyzSu";
            $substringtitle = substr($gcmRegID,-7);
            $combined = $gcmUserName."_".$substringtitle;
            if($conn->query($sql)===TRUE){
                //if(is_dir("users/".$gcmFolderName)===false){
                    mkdir("./users/".$gcmFolderName);
                    //echo "Folder created!";
                //}
                echo "New record created successfully";

            }else{
                echo "Error: " . $sql . "<br>" . $conn->error;
            }
            $conn->close();

            //echo $gcmRegID;
            //file_put_contents("./GCMRegId.txt",$gcmRegID);
            echo "Done!";
            exit;

0 个答案:

没有答案