简体   繁体   English

无法更改文件夹权限 PHP localhost windows

[英]Cannot change Folder permission PHP localhost windows

I am using Xampp for web developing.我正在使用 Xampp 进行 web 开发。 For Many years I am writing data or saving images through php scripts.多年来,我一直在通过 php 脚本编写数据或保存图像。 But for the current project, even though I have created a folder as usual for saving images, no idea why, the folder automatically changes to read-only, and Image is NOT saved to it.但是对于当前项目,即使我像往常一样创建了一个用于保存图像的文件夹,但不知道为什么,该文件夹会自动更改为只读,并且不会将图像保存到其中。 I manually tried to change the permissions, that too NOT working D://xampp/htdocs/sitename/foldername/我手动尝试更改权限,这也不起作用 D://xampp/htdocs/sitename/foldername/

is it really on D://??真的在 D:// 吗?? because by default xampp on windows usually on C partition.因为默认情况下 windows 上的 xampp 通常在 C 分区上。 but yah.. we possibly install it on D too by custom.但是是的..我们也可以通过自定义将它安装在 D 上。

first, when you put local directory in php it should be: D:/xampp/htdocs/sitename/foldername/ (without double slash).首先,当您将本地目录放在 php 中时,它应该是:D:/xampp/htdocs/sitename/foldername/(没有双斜杠)。

example:例子:

<?php
$myfile = fopen("d:/xampp/htdocs/sitename/foldername/newfile.txt", "w") or die("Unable to open file!");
$txt = "Hello world\n";
fwrite($myfile, $txt);
$txt = "Hello World\n";
fwrite($myfile, $txt);
fclose($myfile);
?>

second, ensure folder permission set to 777二、确保文件夹权限设置为777

third, if that directory was outside webroot directory you can try this: enter link description here第三,如果该目录在 webroot 目录之外,您可以试试这个: 在此处输入链接描述

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

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