【发布时间】:2019-06-04 16:15:39
【问题描述】:
我正在升级一些旧的 Codeigniter 2.x 网站以使用 php 7.3 和最新版本的 Codeigniter (3.1.10),并且遇到了一个错误,即 CKFinder 身份验证不再接受 PHP 本机会话这在过去是有效的。
这以前有效:
$_SESSION['authorized'] = TRUE;
然后在 CKFinder 配置中
return isset($_SESSION['authorized']) && $_SESSION['authorized'];
但是,这将不再识别会话。我已经做了一些研究,并通过加载 CI 的 index.php 找到了一些其他解决方案,这些解决方案涉及在 CKFinder 配置中使用 CI 的会话库。例如
//test_session.php (inside the root of CKFinders where config.php is stored)
ob_start();
define("REQUEST", "external");
$temp_system_path = $_SERVER["DOCUMENT_ROOT"].'/system';
$temp_application_folder = $_SERVER["DOCUMENT_ROOT"].'/application';
include($_SERVER["DOCUMENT_ROOT"].'/index.php');
ob_end_clean();
$CI =& get_instance();
if($CI->session->userdata('authorized') === TRUE) {
return true;
}
这段代码在 test_sesion.php 文件中独立工作,虽然我觉得它有点矫枉过正,因为我还必须对 index.php 进行更改以检查这些临时路径,并更新默认控制器忽略外部请求。问题是当我尝试在 CKFinder 配置中实现它时,它会引发一堆 PHP 错误——尤其是我如何将 HVMC 与 Codeigniter 一起使用。
我发现了一个非常相似的问题,但是提供的解决方案不起作用,而且英语很糟糕
Call to a member function item() on null MX/Modules.php Line Number: 8 ckeditor and kcfinder
我想知道是否有人曾经遇到过这种情况,或者知道有一种方法可以绕过它,并且像过去一样使用本机 php 会话。
【问题讨论】:
-
您提供的方法是我发现的唯一一种可用于 ci 范围之外的应用程序的方法。
标签: php codeigniter ckfinder