且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在/var/www/joomla2.5/database.php中找不到JFactory,JDatabase类

更新时间:2022-06-07 05:58:28

仅将文件放在joomla文件夹中并不能访问joomla库. 使其成为标准的joomla组件或模块,或者将以下代码添加到您的php文件中

Just putting a file inside joomla folder doesn't gave it access to joomla libraries. Either make it as standard joomla component or module or add follwing code to your php file

define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__).'/' );   // should point to joomla root
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe = JFactory::getApplication('site');