TP在Linux下的权限暂行解决办法

浏览:2389 发布日期:2013/01/07 分类:技术分享
修改 ./ThinkPHP/Common/runtime.php

增加调试模式下将APP_PATH目录权限设置成0777。

在此文件底部增加如下代码:

function chmodr($path, $filemode) {
if (!is_dir($path))
return chmod($path, $filemode);

$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..') {
$fullpath = $path.'/'.$file;
if(is_link($fullpath))
return FALSE;
elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode))
return FALSE;
elseif(!chmodr($fullpath, $filemode))
return FALSE;
}
}

closedir($dh);

if(chmod($path, $filemode))
return TRUE;
else
return FALSE;
}

// 加载运行时所需文件
load_runtime_file();

if (APP_DEBUG)
chmodr(APP_PATH, 0777);

// 记录加载文件时间
G('loadTime');
// 执行入口
Think::Start();

最佳答案
评论() 相关
后面还有条评论,点击查看>>