如果在外部PHP文件使用joomla的类库


这样就可以了:

<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );//this is when we are in the root
define( 'DS', DIRECTORY_SEPARATOR);
//导入
require_once (JPATH_BASE.DS.'includes'.DS.'defines.php');
require_once (JPATH_BASE.DS.'includes'.DS.'framework.php');
//初始化Joomla的相关信息
$mainframe =&JFactory::getApplication('site');
$mainframe->initialise();
//过的当前用户
$user = &JFactory::getUser();
if(!$user->get("username")){
?>
你还未登录!
<?php
}


你可能感兴趣的:(如果在外部PHP文件使用joomla的类库)