我正在编写将disqus注释转换为hashover系统的代码,我有如下代码:
// $threads is list of threads from disqus api that I cached on disk
foreach ($threads as $thread) {
$dir_name = getSafeThreadName(preg_replace("%^https?://[^/]+%", "", $thread['link']));
$dir = 'threads/' . $dir_name;
if (!is_dir($dir)) {
mkdir($dir);
chmod($dir, 0774);
}
// ...
// $thread_posts are $post that belong to $thread
foreach($thread_posts as $post) {
$xml = new SimpleXMLElement('<comment/>');
// ...
// $name_arr is array of numbers for HashOver comments
$fname = $dir . '/' . implode('-', $name_arr) . ".xml";
$f = fopen($fname, 'w');
fwrite($f, $xml->asXML());
fclose($f);
chmod($fname, 0664);
}
}
它为我在线程中的每个文章创建了一个目录,这些线程是用所有者读/写的。
apache:apache
里面有文件
1.xml
与业主
root:root
为什么
根:根
?我怎么做
Apache:Apache
是吗?
编辑:
这不是副本,我不想将权限更改为
Apache:Apache
从
根:根
,可以使用
chown
但是我想做,这样它就不会变为
根:根
首先,我还想知道为什么它变成了
根:根
.对于我来说,这看起来像是php或apache中的一个bug,或者是apache中的一些错误配置。我不认为是代码,因为它只是打开、写入和关闭文件。