我在CakePHP的TMP文件夹中写入文件时收到权限错误
我的代码如下所示,我在tmp文件夹中写了一个扩展名为.xml的文件,但是获得了权限错误。
$docroot = TMP_FILE . "files/";
$filename = $this -> request -> data['xmlEditor_Name'];
$filename = $docroot . DS . $filename . '.xml';
$filename1 = $this -> request -> data['xmlEditor_Name']. '.xml';
$xml = "<?xml version='1.0' encoding='UTF-8'?>";
$xml .= $this -> request -> data['xmlEditor_Document'];
$handle = fopen($filename, 'x+') or die('Permission error');
fwrite($handle, $xml);
fclose($handle);