繁体   English   中英

mkdir()权限被拒绝-PHP

[英]mkdir() permission denied - PHP

我正在尝试基于HTML表单输入制作XML文档。 但是,一旦执行了php,我就会得到一个页面,上面写着: 在此处输入图片说明

<?php
header('Content-type: text/xml');
$dom = new DOMDocument("1.0","UTF-8");
$customer = $dom->createElement("customer");
$dom->appendChild($customer);

$dir = 'XMLfiles';
if ( !file_exists($dir) ) {
 $oldmask = umask(0);  // helpful when used in linux server  
 mkdir ($dir, 0744);
 }

$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$password = $_POST['password'];
$cust = $dom->createElement("customer");
$customer->appendChild($cust);
$name = $dom->createElement("fname",$fname);
$cust->appendChild($name);
$emailxml = $dom->createElement("Email", $email);
$cust->appendChild($emailxml);
$contactxml = $dom->createElement("Contact", $contact);
$cust->appendChild($contactxml);
$passxml = $dom->createElement("Password", $password);
$cust->appendChild($passxml);
//$dom->saveXML();
$dom->save($dir."/customer.xml");

?>

为我指出正确的方向,我将学习它。

感谢大家!

PS:我正在Mac上尝试此操作(如果这在授予权限和填充方面有所不同)。 我是编程新手,所以请忽略任何无关紧要的内容或向我提出建议。

刚遇到有关Apple支持的帖子,该帖子解释了添加权限。 我只是这样做:查看信息->文件共享和权限->将所有内容更改为读/写。

我现在结束这个问题。

暂无
暂无

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

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