大家好,欢迎来到IT知识分享网。
如题,我当前的网站目录是/var/www/html(777权限)
然后我的
/var/www/html/g/data/visit.php 文件
require(“../function.php”);
if (file_exists($_SERVER[“DOCUMENT_ROOT”]. “/cache/vc-$date.json”)) {
echo file_get_contents($_SERVER[“DOCUMENT_ROOT”]. “/cache/vc-$date.json”);
} else {
$res=get_sum();
$days1=get_days(1);
$month=get_this_month();
$result=[“visit”=>$res,’days’=>$days1,’month’=>$month];
$echo = json_encode($result);
cache_this($echo,’vc-‘.$date);
echo $echo;
}
function.php
function cache_this($result,$name){//内容,命名规则
//file_put_contents(“/cache/$name.json”, $result)or die(“Unable to open file!”);
$myfile = fopen($_SERVER[‘DOCUMENT_ROOT’].”/cache/$name.json”, “w”) or die(“Unable to open file!”);
$txt = $result;
fwrite($myfile, $txt);
fclose($myfile);
}
这是我ls -l的部分结果
-rwxrwxrwx. 1 root root 81 11月 4 2013 bottom.php
drwxrwxrwx. 2 apache apache 4096 11月 10 17:09 cache
然后我看了httpd.conf里面的user和group,都是apache没有错
但是这个json文件就是写不进cache文件夹里面,$myfile总是返回false。
求教这个是什么问题,已经折腾了一晚上,双十一centos讨论群里面都在水,也没问出个究竟……
急求…………………………(无力
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/101182.html