【发布时间】:2012-05-02 07:26:00
【问题描述】:
我需要检查用户是否在 CodeIgniter 中登录。
登录发生在 Joomla 网站中。
我尝试了以下方法来初始化 joomla。
define( '_JEXEC', 1 );
define( 'DS', DIRECTORY_SEPARATOR );
define('JPATH_BASE', dirname(__FILE__) );
require_once ("../includes/defines.php");
require_once ("../includes/framework.php");
$mainframe =& JFactory::getApplication("site");
$mainframe->initialise();
$session =& JFactory::getSession();
$user = $session->get( 'user' );
但我收到了这条消息:
找不到配置文件,也没有可用的安装代码。 退出...
Joomla 安装在 root 上,codeigniter 安装在 root/advanced 上
我正在调用控制器中的代码。
我该如何解决这个问题?
编辑:
现在我收到此错误:
遇到了 PHP 错误
严重性:通知
消息:未定义变量:BM
文件名:core/CodeIgniter.php
行号:364
编辑
我的控制器看起来像这样
function is_logged()
{
define( '_JEXEC', 1 );
define( 'JPATH_BASE', '../');
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
//require_once ("../libraries/joomla/user/authentication.php");
$mainframe =& JFactory::getApplication("site");
$mainframe->initialise();
$session =& JFactory::getSession();
$user = $session->get( 'user' );
}
目录结构
--Public_html
--Joomla Istallation files
--Advanced [This is a folder ,i installed codeignitor on this folder]
所以 joomla 的路径是 site.com/ 而 Codeignitor 的路径是 site.com/advanced
有关错误的更多信息
Codeignitor Core 上的第 364 行说:
// Mark a benchmark end point
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
我可以在 CI 核心启动时看到以下内容
$BM =& load_class('Benchmark', 'core');
$BM->mark('total_execution_time_start');
$BM->mark('loading_time:_base_classes_start');
【问题讨论】:
-
看到这个帖子,它可能会有所帮助:codeigniter.com/forums/viewthread/183808/#879291
-
@AlphaMale
core/CodeIgniter.php...当我包含 joomla 的framework.php文件时会发生这种情况... -
请出示您的代码。
-
@AlphaMale 没有太多代码可以显示..只有一个控制器..我认为 joomla 中的 codeignitor 存在一些问题..
-
不告诉我那个 BM 变量在哪里??
标签: php codeigniter session joomla