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

来源:互联网 发布:lol小智淘宝店 编辑:程序博客网 时间:2024/05/16 10:20


这样就可以了:

<?phpdefine( '_JEXEC', 1 );define('JPATH_BASE', dirname(__FILE__) );//this is when we are in the rootdefine( '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}


原创粉丝点击