php写文件并设置权限 [英] php write file and set permission

查看:435
本文介绍了php写文件并设置权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个php文件,无需手动设置权限即可直接进行编辑.

I'm trying to create a php file which I can edit straight away without manually set the permissions.

我正在尝试...

<?php

$var = '<?php $mycontent = new Content(); echo $mycontent->block($p_name);?>';

$myFile = "testFile.php";

$fh = fopen($myFile, 'w+') or die("can't open file");

$stringData = $var;

fwrite($fh, $stringData);

fclose($fh);

?>

...它会创建文件,但是当我尝试在IDE中编辑文件时,它当然不会让我使用.我必须手动设置创建文件的权限.有什么方法可以创建文件并设置权限?

...it creates the file, but when I try to edit the file in my IDE it won't let me of course. I have to manually set the permission of the file created. Is there any way I can create the file and have the permission already set?

预先感谢

毛罗

推荐答案

是的,您可以感谢

这篇关于php写文件并设置权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆