学而实习之 不亦乐乎

使用CKFinder时出现"The file browser is disabled for security reasons."的错误

2019-01-23 20:37:41

在使用CKFinder时出现下面的错误:
The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file.

经过上网查找资料发现,问题出现在 /ckfinder/config.php 文件中。原文件中关于身份验证的部分如下:

$config['authentication'] = function () {
    return false;
};

为了安全,这里应该进行身份验证的,如下:

session_start();

$config['authentication'] = function() {
 return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
};